Error by using csvread
1 view (last 30 days)
Show older comments
Hi, when I use this code:
k=0;
num=0:1:400;
for k=1:num(end)
cad = [];
cad = 'scope_%d_1.csv';
ss = [];
ss = sprintf(cad,num(k));
i=0;
cont=0;
s = csvread('ss', 2, 0);
[fil,col]=size(s);
for i=1:fil
if ((s(i,2))< 0.5)&&(s(i+1,2)-(s(i,2))>2)
cont=cont+1;
if (cont==25)
display(s(i, 1));
break
end
end
end
end
Im getting this error and I dont know why:
Error using dlmread (line 120)
The file 'ss' could not be opened because: No such
file or directory
Error in csvread (line 48)
m=dlmread(filename, ',', r, c);
Error in Matlab (line 10)
s = csvread('ss', 2, 0);
Any idea?
0 Comments
Answers (1)
Image Analyst
on 24 Mar 2015
Don't put quotes around it - that makes it a string literal. Try is this way, with just the variable:
s = csvread(ss, 2, 0);
And it would be better to pick more descriptive variable names, like "filename" instead of ss.
See Also
Categories
Find more on Software Development Tools in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!