フィルターのクリア

New data in same plot

1 回表示 (過去 30 日間)
Marlon
Marlon 2023 年 10 月 10 日
回答済み: Sulaymon Eshkabilov 2023 年 10 月 10 日
Hello everyone,
I'm trying to keep the plot of a variable in the same figure in which the data of the new data for this variable gets plottet when I run the code again, so I see the changes in the plot that result after changing of certain parameters.
Can somebody help me with this?
Thanks in advance!

回答 (2 件)

Walter Roberson
Walter Roberson 2023 年 10 月 10 日
In some cases you can use hold
This will, however, not work if the code contains a call to figure that does not have a numeric parameter , such as if it calls
figure()
That call would open a new figure and further drawing would typically happen on the new figure.

Sulaymon Eshkabilov
Sulaymon Eshkabilov 2023 年 10 月 10 日
If understood your question correctly, simply use hold command, e.g.:
t = linspace(0, 2*pi, 1e3);
L = {};
for omega = 1:5
F = sin(omega*t);
plot(t,F), hold on
L{omega} = ['\omega = ' num2str(omega)];
legend(L{:})
end

カテゴリ

Help Center および File ExchangeVisual Exploration についてさらに検索

製品


リリース

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by