'addpoints' animation with a control slider

Somehow making an animation with 'addpoints' enables a control slider for the user to slide back and forth to view the animation, but sometimes the slider disappears. Which syntax ensures that it appear?

10 件のコメント

feynman feynman
feynman feynman 2022 年 12 月 19 日
?
Adam Danz
Adam Danz 2022 年 12 月 19 日
Could you attach a minimal working example that reproduces the problem?
Also please fill in your release information in the right side panel of this thread.
feynman feynman
feynman feynman 2022 年 12 月 19 日
h =animatedline(Color=[0.85 0.325 0.098]);
for x = linspace(0,4*pi,10000)
y = sin(x);
addpoints(h,x,y)
drawnow
end
feynman feynman
feynman feynman 2022 年 12 月 19 日
I wanted to add the release info in the right panel but wasn't able to do so.
release info=r2021a
Steven Lord
Steven Lord 2022 年 12 月 19 日
You have to specify a product before you can specify a release.
Adam Danz
Adam Danz 2022 年 12 月 19 日
Are you using a regular figure produced by figure or a uifigure or is this within an app?
Are you using a uislider?
feynman feynman
feynman feynman 2022 年 12 月 20 日
thank you, just a regular figure
feynman feynman
feynman feynman 2024 年 2 月 7 日
as long as sth that can help control the animation, replay and stop
Adam Danz
Adam Danz 2024 年 2 月 13 日
I'm not aware of a slider that automatically appears after running the code you shared.
If this is run in an app or live script, a uislider could be added, though.
feynman feynman
feynman feynman 2024 年 2 月 15 日
Yes, in a live script! My newest concern is how to stop an animation loop perhaps through a uicontrol in a live script?
https://www.mathworks.com/matlabcentral/answers/2079766-how-to-stop-loops-or-close-figures-in-live-scripts?s_tid=srchtitle

サインインしてコメントする。

回答 (1 件)

Vidip Jain
Vidip Jain 2023 年 3 月 20 日

0 投票

The slider you are referring to is called a "data cursor" in MATLAB. By default, it appears when you create a plot with a line object, and you hover over the line with your mouse cursor. However, it may not always appear when using “addpoints” to animate a plot.
To ensure that the data cursor appears, you can use the “datacursormode” function in MATLAB. This function allows you to enable or disable the data cursor mode for a specific plot or all plots in a figure.
You can also customize the appearance and behavior of the data cursor using various options available in the “datacursormode” function.

1 件のコメント

feynman feynman
feynman feynman 2023 年 4 月 27 日
thanks a lot. "it may not always appear when using “addpoints” to animate a plot." Does the appearance depends on luck? How can this be a random event?

サインインしてコメントする。

カテゴリ

ヘルプ センター および File ExchangeAnimation についてさらに検索

製品

リリース

R2021a

タグ

質問済み:

2022 年 12 月 3 日

コメント済み:

2024 年 2 月 15 日

Community Treasure Hunt

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

Start Hunting!

Translated by