×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

importing a text file and sort out the frequecny of each character

importing a text file and sort out the frequecny of each character

importing a text file and sort out the frequecny of each character

(OP)
x =' hskd';
X = sort(x);
[U I J] = unique(X);
N = diff([0 I]);
bar(N)
set(gca,'XtickLabel',U.')


[num2str(N.') U.']

the code above will allow me to sort out the frequency of the charcher
appear in x .

e.g the result is 1h 1s 1k 1d

now i want to import a text file from the directory  
'C:\MATLAB6p5\work\test.txt' and the content of test.txt is hskd.

i wish to to use the same program to sort out the frequecny for each
character but when i try to use the fuction importdata it wouldnt work
...... does anyone know how to do it ..

this is the m file i written


x =importdata('C:\MATLAB6p5\work\test.txt')

X = sort(x);
[U I J] = unique(X);
N = diff([0 I]);
bar(N)
set(gca,'XtickLabel',U.')


[num2str(N.') U.']

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources