delkov
delkov

Reputation: 311

Open file with blank spaces in filename matlab

How can I open file like this:

fid = fopen('2016 05 23_filename.dat','rt');

i.e the filename contains spaces.

The global point is open all files in current folder, and write them to data.

Upvotes: 0

Views: 503

Answers (1)

Suever
Suever

Reputation: 65430

There is no issue in how you have this written. The only reason you may be having issues is if you typed the filename in incorrectly. You can check this by scripting it to open all files in your folder:

files = dir('*.dat');
for k = 1:numel(files)
    fid = fopen(files(k).name, 'rt');

    %// Do stuff
    fclose(fid);
end

Upvotes: 1

Related Questions