Azzera filtri
Azzera filtri

Error by using csvread

1 visualizzazione (ultimi 30 giorni)
Antonio Jayena
Antonio Jayena il 24 Mar 2015
Commentato: Antonio Jayena il 24 Mar 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?

Risposte (1)

Image Analyst
Image Analyst il 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.

Categorie

Scopri di più su Model Import in Help Center e File Exchange

Tag

Community Treasure Hunt

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

Start Hunting!

Translated by