Matlab - How to read values from a text file? -
this question has answer here:
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
Post a Comment