Unable to read text file contents
1 view (last 30 days)
Show older comments
Hello
i need a solution for my question that is
i am using matlab 7 version software and written a program to get the contents of text file and do further computation, my program is
fid = fopen('example.txt') while 1 tline=fgetl(fid) if ~ischar(tline),break,end end fclose(fid)
and contents of my text file is " Folder name : har File name : example frequencies which are present on the diagonal are: f1=0 f6=27 f7=34 frequencies which are not present on the diagonal are: f2=1 f3=19 f4=20 f5=21 "
my question is i am getting the contents of the file, but not able to save that data in some variable to do further computation, ie., not able to give array indexing for that. i have tried some how but i was getting error as " subscripted assignment mismatch ". can you please solve my problem.
1 Comment
Geoff Hayes
on 8 Sep 2014
Zamrud - are you just presenting an example above or does your text file only include one line? If more than one line in the text file, is there a particular format for each line or is it just a string? And what information do you wish to extract from that line (or lines) for further computation? It may be helpful to attach (using the paperclip button) an example of the file you wish to read in.
Answers (0)
See Also
Categories
Find more on Large Files and Big Data in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!