Matlab - How to read values from a text file? -


i aware question may seem similar others having been posted. however, have browsed through answers apparently close questions, still couldn't want. hence, asking mine again.

i have text file (data.txt) of type.

studenta 10  studentb 5  studentc 3 ... 

the data in same row separated tab.

how can read values (that means numbers 10, 5, 3, etc.) matlab , ignore studenta, studentb, etc.?

i did following.

fid=fopen('grades.txt','r');  m=fscanf(fid, '%d'); 

but matlab showed was:

m =       [] 

how about

fid = fopen('grades.txt','r'); = textscan(fid,'%s %d','delimiter','\r\n'); = a{1}; 

it should work in case.


Comments

Popular posts from this blog

php - Why I am getting the Error "Commands out of sync; you can't run this command now" -

linux - Does gcc have any options to add version info in ELF binary file? -

java - Are there any classes that implement javax.persistence.Parameter<T>? -