plot, Invalid first data argument

I cannot find what's the problem with the below code. It gives me invalid fist data argument erorr. I want to plot four graphs on one figure.
Case={'Obs', 'Q0', 'Q3', 'Q4'};
for i=1:4
load(sprintf('Monthly_Mean_Precip_%s.mat',Case{i}));
end
for j=1:4
Precip{j}=sprintf('Monthly_Mean_Precip_%s',Case{j});
end
Ncomponent = 4;
for PrecipNo=1:Ncomponent
figure;
plot(Precip{PrecipNo});
end

답변 (1개)

Sean de Wolski
Sean de Wolski 2013년 2월 21일

0 개 추천

dbstop if error
Then run the above *.m file. It will stop with the debugger and you'll be able to investigate what is going on.

댓글 수: 7

Bum
Bum 2013년 2월 21일
It stopped after 'figure'. The error occurs on the line 'plot(Precip{PrecipNo}'
so what does that look like?
Precip{PrecipNo}
Is that something you would expect to plot?
Bum
Bum 2013년 2월 21일
No, only plot window and no figure
Sean de Wolski
Sean de Wolski 2013년 2월 21일
What is the output from the above - at the command line!!
Is it a vector, matrix, empty, string, object of class Sean, etc.?
Bum
Bum 2013년 2월 21일
'Monthly_Mean_Precip_%s' is 12x1 double.
Bum
Bum 2013년 2월 21일
편집: Bum 2013년 2월 21일
Is the error in plot is because of the class of 'Precip{PrecipNo}' is char? Then what shoud I have to do?
Sean de Wolski
Sean de Wolski 2013년 2월 22일
I don';t know. What does it look like as a char?

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

카테고리

도움말 센터File Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기

질문:

Bum
2013년 2월 21일

Community Treasure Hunt

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

Start Hunting!

Translated by