Borrar filtros
Borrar filtros

How to go back in a loop?

2 visualizaciones (últimos 30 días)
Jay Cheng
Jay Cheng el 1 de Sept. de 2015
Respondida: Image Analyst el 1 de Sept. de 2015
I use "pause" in a "for loop" to display 100 plots one by one. That is, I can hit space key to advance in the loop sequentially to show plot 1, 2, then 3 until 100. But sometime my collaborator wants me to go back in the plots (e.g, while I am showing plot number 50, he asks me to show 49 again). Then I have to modify the code to display the plot 49.
I know I can use GUI to display plots both going forward vs. going backward. But is there any non-GUI method that I can do this? GUI is hard to maintain and modify.
Sincerely, Cheng

Respuestas (1)

Image Analyst
Image Analyst el 1 de Sept. de 2015
See if this will work for you:
captions = cell(100,1);
for k = 1 : 100
captions{k} = sprintf('Display Plot #%d', k);
end
button = menu('Choose a plot', captions);

Categorías

Más información sobre Interactive Control and Callbacks en Help Center y File Exchange.

Etiquetas

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by