Also, when case 1 is called (or true) second time, image shown at same place results in mixing up the title names...(and imshow() overwrites the older image). So, if there are different size of image, We can see all images (full or fraction) instead of seeing current case's image/s.
imshow, axes in GUI, cla not working
2 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Hello,
Number of axes created for displaying image depends on the slider value. switch slidervalue with two case is shown below:
switch slidervalue
case 1
RA = axes('units','pixels','Position',[350 12 868 320]); axes(RA); cla;
imshow(firstM); title(['D = : ', num2str(DISTANCE(1))]);
case 2
RA1 = axes('units','pixels','Position',[368 9 418 320]); axes(RA1); cla;
imshow(firstM); title(['D = : ', num2str(DISTANCE(1))]);
RA2 = axes('units','pixels','Position',[802 9 418 320]); axes(RA2); cla;
imshow(secondM); title(['D = : ', num2str(DISTANCE(2))]);
after case 1(shown image by RA axes), if second call is for case 2 - it will overwrite the case 1 image.(Case 2 images shown on case 1 image) most part of case 1 image is still visible
I think cla is not working. Tried this also: axes property- NextPlot value = replace, new, replacechildren, etc. that didn't work. reset , delete axes also didn't work.
can anyone provide solution:? I want to clear axes before displaying other ones...
Risposta accettata
Roberto
il 7 Mag 2014
Modificato: Roberto
il 7 Mag 2014
This is because RA axes is still visible and you are creating one axe every time,
to create just one axe try this code outside your function right at the beginning of the file, after the 'Do not edit' and the guidata command line (I'm assuming some characteristics of your code, did you created with GUIDE? or else, upload your code!):
% Choose default command line output for WHATEVER.m
handles.output = hObject;
% Update handles structure
guidata(hObject, handles);
handles.RA = axes('units','pixels','Position',[350 12 868 320]);
handles.RA1 = axes('units','pixels','Position',[368 9 418 320]);
handles.RA2 = axes('units','pixels','Position',[802 9 418 320]);
guidata(hObject,handles);
And then have the handles values passed to your function...
function slider_Fnc_Callback(hObject,EventData,handles)
switch slidervalue
case 1
set(handles.RA,'Visible','on');
set(handles.RA1,'Visible','off');
set(handles.RA2,'Visible','off');
axes(handles.RA); cla; imshow(firstM);
title(['D = : ', num2str(DISTANCE(1))]);
case 2
set(handles.RA,'Visible','off');
set(handles.RA1,'Visible','on');
set(handles.RA2,'Visible','on');
axes(handles.RA1); cla; imshow(firstM);
title(['D = : ', num2str(DISTANCE(1))]);
axes(handles.RA2); cla; imshow(secondM);
title(['D = : ', num2str(DISTANCE(2))]);
Or something like this!
3 Commenti
Più risposte (0)
Vedere anche
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!