Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: Open and read multiple files in Matlab
Replies: 3   Last Post: Oct 9, 2013 9:56 AM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
JASKARAN SINGH

Posts: 1
Registered: 10/8/13
Open and read multiple files in Matlab
Posted: Oct 8, 2013 9:25 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

i am trying to read a number of files (nearly 100) from a specified directory. It contains data in a Single column. Firstly i am not sure what extensions the files are in...(because they open in notepad but they are not text files... when right click on the file to see properties it just shows 'File') . The file names are like ACC1_0090, ACC1_0091.. and so on....
The code i am using is as follows.... (i am trying to change the name of the files and then trying to open them)

d=dir('*.')
for k = 1:2
matFilename = sprintf('mat%f.', k);
textFilename1 = ['file', num2str(k), '.'];
fid = fopen('textFilename');
textData = fscanf(fid);
fclose(fid);
end

i have used dir('*.') to read the concerned files from a directory ...
but the 'fid' value turns out to be -1 here.. so the fscanf function does not work...

please if any one can correct my code.....



Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.