Filter löschen
Filter löschen

Error by using csvread

1 Ansicht (letzte 30 Tage)
Antonio Jayena
Antonio Jayena am 24 Mär. 2015
Kommentiert: Antonio Jayena am 24 Mär. 2015
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?

Antworten (1)

Image Analyst
Image Analyst am 24 Mär. 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.

Kategorien

Mehr zu Model Import finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by