필터 지우기
필터 지우기

Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

To lain...saving 5 plots for each i in a loop

조회 수: 2 (최근 30일)
Kompella
Kompella 2013년 6월 7일
마감: MATLAB Answer Bot 2021년 8월 20일
thank you lain. I got it right now. Sorry if I'm troubling you... I have another question. That is just for one plot. But for each value of i I have 5 plots. I tried using same h = plot( fitresult{1}, xData, yData );...but it is not working.This is wat matlab showed. An error.
Operands to the and && operators must be convertible to logical scalar values.
Error in saveas (line 64) while ~isempty(h) && ~isfigure(h)
I tried using h(1),h(2)...h(5). still it didn't work.
Please help me in doing that
  댓글 수: 2
Image Analyst
Image Analyst 2013년 6월 8일
That is not the full error message. saveas doesn't even show up on that line. Post the full error message - all the text in red.
Kompella
Kompella 2013년 6월 8일
편집: Kompella 2013년 6월 8일
Operands to the | | and && operators must be convertible to logical scalar values.
Error in saveas (line 64)
while ~isempty(h) && ~isfigure(h)
Error in Experiment2 (line 151)
saveas(h,filename1)
this is what it showed.....
Here Experiment2 is the script file I have written. saveas is inbuilt script file.
This is how I used it....
% Plot fit with data.
h = plot( fitresult{1}, xData, yData );
legend( h, 'Heights1 vs. Centers1 with Weights1', 'N vs (J-H) Mag-1', 'Location', 'NorthEast' );
% Label axes
xlabel( 'Centers1' );
ylabel( 'Heights1' );
grid on
% Save this plot in C:\Users\SRINATH KOMPELLA\Documents\MATLAB\N vs (J-H) Mag-1.
filename2 = ['C:\Users\SRINATH KOMPELLA\Documents\MATLAB\N vs (J-H) Mag-1\SingleGaussian',num2str(d),'.fig'];
saveas(h,filename1).....this is the 151st line of my script

답변 (1개)

Image Analyst
Image Analyst 2013년 6월 8일
I presume you've defined d and filename1 somewhere else (above) in the script? Are you sure you didn't mean filename2? What happens if you pass gca or gcf into saveas() instead of h?
Why not use export_fig() like most other people? ( http://www.mathworks.com/matlabcentral/fileexchange/

이 질문은 마감되었습니다.

태그

Community Treasure Hunt

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

Start Hunting!

Translated by