MATLAB Answers

0

Why "File not found"?

Asked by Matlaber on 13 Feb 2019 at 22:16
Latest activity Commented on by Matlaber on 14 Feb 2019 at 11:17
I am trying to follow the example of csvread here
filename = 'csvlist.dat';
M = csvread(filename)
I have csvlist.dat file save in my matlab directory.
>> M = csvread('csvlist.dat')
Error using csvread (line 35)
File not found.
I need to import my data, but which to select?
Capture.PNG
Thank you

  4 Comments

Show 1 older comment
Matlaber on 13 Feb 2019 at 22:26
Thanks for your reply.
>> ls *.dat
csvlist.dat
Walter Roberson
on 13 Feb 2019 at 23:15
I wonder if there is a hidden character? Try
dinfo = dir('*.dat');
filename = {dinfo.name};
fprintf('found file named "%s"\n', filename);
fprintf('The representation of that is: \n');
disp(0 + filename);
and show us the output.
If the output is something different than
99 115 118 108 105 115 116 46 100 97 116
then you might have unusual characters in the name.
Matlaber on 14 Feb 2019 at 11:17
Thanks.
I found the mistake is the file name:
for CSV file
A_B_C.csv --> ABC.csv
for .dat file:
A_B_C.dat -> A_B_C.dat
I written ABC.dat that is why did not work.

Sign in to comment.

Tags

0 Answers