How to use imagesc in a time loop?

4 visualizaciones (últimos 30 días)
Tilia Selldén
Tilia Selldén el 15 de Nov. de 2019
Comentada: Tilia Selldén el 15 de Nov. de 2019
Hi,
I am using imagesc to visualize a binary matrix (of zeroes and ones), which, at every time step, changes (more ones apperars).
I want the figure to hold on each time step so that I can visulize the change in the matrix. How can i do that with out 100 figures popping up?
This is the code for the figure:
for time = 1:timeSteps
newMatrix = GenerateNewMatrix(matrix,probability);
matrix = newMatrix;
figure; hAxes = gca;
imagesc(hAxes, matrix);
colormap(hAxes , [1 1 1; 1 0 0; 0 1 0] );
end

Respuesta aceptada

KSSV
KSSV el 15 de Nov. de 2019
for time = 1:timeSteps
newMatrix = GenerateNewMatrix(matrix,probability);
matrix = newMatrix;
hAxes = gca;
imagesc(hAxes, matrix);
colormap(hAxes , [1 1 1; 1 0 0; 0 1 0] );
end
Remove the figure line in the loop.
  1 comentario
Tilia Selldén
Tilia Selldén el 15 de Nov. de 2019
I have tried that but that only generates the last figure and not the time siries

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Graphics Object Properties en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by