How can I change animation speed in a plot?

Hello everyone!
I am trying to plot an animation using animatedline function and also controlling the speed of the animation using popupmenu. (such as 1/2x,1x,2x,4x etc).
I don't have any problem to create my animations in different speed.
The problem is , for example when I click "case 3" it starts to plot the animation and when I click case 4 (without waiting the end of the animation of case 3) it creates new one (case 4). Until this time still I don't have any problem. However, when "case 4" is ended the previous selection is going on (case 3). I want to figure out this issue. What I want is it should forget the previous one once I make a new selection.
I attached my code in below.
Is there any solution for this problem?
Thanks in advance.
switch get(handles.threeDOF_animation_speed,'Value')
case 1
case 2
run('threeDOF_create_animation.m')
set(handles.button_3DOF_save_gif,'Enable','on')
case 3
run('threeDOF_create_animation.m')
set(handles.button_3DOF_save_gif,'Enable','on')
case 4
run('threeDOF_create_animation.m')
set(handles.button_3DOF_save_gif,'Enable','on')
case 5
run('threeDOF_create_animation.m')
set(handles.button_3DOF_save_gif,'Enable','on')
end

1 Comment

Try using break within the switch case statements. If possible share the code to replicate the issue.

Sign in to comment.

Answers (0)

Categories

Asked:

on 9 Nov 2019

Commented:

on 12 Nov 2019

Community Treasure Hunt

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

Start Hunting!