The Math Forum

Search All of the Math Forum:

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

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

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

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 ]

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)

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

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]

© The Math Forum at NCTM 1994-2018. All Rights Reserved.