how to change axes in loops
4 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
i want to change axes so i can show images in different axes. here is my code
n = 13;
for m = 1:n
for idfile = 1:indSim(m)
if idfile < 10
name_file = strcat('000',num2str(idfile));
elseif idfile < 100
name_file = strcat('00',num2str(idfile));
elseif idfile < 1000
name_file = strcat('0',num2str(idfile));
else
name_file = strcat(num2str(idfile));
end
end
str_img_name = strcat(folder, name_file, '.jpg');
returned_img = imread(str_img_name);
axes(handles.axes(m));
imshow(returned_img);
end
but i've got an error like this 'Reference to non-existent field 'axes'.' how can i change axes depends on `m` in the loops?
0 Commenti
Risposte (1)
Adam
il 25 Nov 2014
Modificato: Adam
il 25 Nov 2014
Your axes will each have a 'Tag'. If you used Guide to create your GUI which I am guessing you did from the 'handles' usage then you will need to gather the axes handles together into an array by accessing them as e.g.
handles.hAxes = [ handles.axes1, handles.axes2, handles.axes3 ];
Then use
axes( handles.hAxes(m) )
to change axes.
Personally I favour:
imshow( returned_img, 'Parent', handles.hAxes(m) );
rather than explicitly changing the current axes with:
axes( handles.hAxes(m) )
but that should work too.
0 Commenti
Vedere anche
Categorie
Scopri di più su Lighting, Transparency, and Shading in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!