フィルターのクリア

Hold on in for loop doesn't work

5 ビュー (過去 30 日間)
Federico Zappaterra
Federico Zappaterra 2020 年 5 月 23 日
回答済み: Rik 2020 年 5 月 23 日
I want to plot several curves using a for loop, but hold on doesn't work.
I also tried to set the property of 'axis' (i.e. see below 'figure()') but it doesn't work.
The only thing that I could do is hardcoding the number of the figure (i.e. see above figure(1)).
for ii = 1:5
d = dlmread([data{ii} '\simulation_results.txt'],'\t',delLine,0);
ang = d(:,2);
y = d(:,featCol);
% Consider only the last shaft revolution
ang = ang-(ang(end)-360);
y = y(ang>0);
ang = ang(ang>0);
% figure(1)
figure()
% set(gca,'NextPlot','add')
plot(ang,y,'linewidth',1.5)
hold on; grid on;
Why it doesn't work using hold on or setting the properties?

回答 (1 件)

Rik
Rik 2020 年 5 月 23 日
You are calling figure inside the loop. You need to put that outside of the loop, or make sure another way that you have a single figure.

カテゴリ

Help Center および File ExchangeGraphics Object Programming についてさらに検索

製品


リリース

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by