필터 지우기
필터 지우기

Error by using csvread

조회 수: 1 (최근 30일)
Antonio Jayena
Antonio Jayena 2015년 3월 24일
댓글: Antonio Jayena 2015년 3월 24일
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?

답변 (1개)

Image Analyst
Image Analyst 2015년 3월 24일
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.
  댓글 수: 1
Antonio Jayena
Antonio Jayena 2015년 3월 24일
Thank you very much :)

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Model Import에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by