Matlab 2D Movie animation

Hi, this is my code:
for strIndex = 1:length(str)
%Reference to a cell
name = str{strIndex};
imagesc(eval(name));
%Using jet colormap and colorbar
colormap(jet);
colorbar;
axis image;
axis off;
newStr = split(name, '_');
title(newStr{3});
drawnow;
%Save each frame into M
M(strIndex) = getframe(gcf);
end
when I try to run the for loop I keep getting an error that says
"Error in heatmap_display (line 28)
imagesc(eval(name));"
what does this mean and what can I do about it?

 Accepted Answer

Cris LaPierre
Cris LaPierre on 11 Jan 2021
Edited: Cris LaPierre on 11 Jan 2021
We don't know what name is, but I assume a list of image files?
You are not loading the image first. Load it to a variable, then use imagesc to display it.
I don't think it makes sense to use eval here. The steps could be
name = str{strIndex};
im = imread(name);
imagesc(im);

More Answers (0)

Categories

Community Treasure Hunt

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

Start Hunting!