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?

답변 (1개)

Adam
Adam 2014년 11월 25일
편집: Adam 2014년 11월 25일

0 개 추천

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.

카테고리

도움말 센터File Exchange에서 Creating, Deleting, and Querying Graphics Objects에 대해 자세히 알아보기

태그

질문:

2014년 11월 25일

편집:

2014년 11월 25일

Community Treasure Hunt

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

Start Hunting!

Translated by