From: Varun on 28 Jun 2010 09:38 Hi All, I have built a Matlab GUI programmatically that displays multiple figures using 'Axes' and 'Text Box' and a 'Popup Menu'. I use the switch case in order to display images of different series. After creating an axes I use the imshow function to display the images. So for example, in one case 21 images need to be displayed while in another case 16. I create the axes in the popup menu callback function. The problem is like if I switch from the case of 21 images to 16 images, the last 5 images of the previous case is still present and not removed. I have tried delete(AxesHandle) function but the image still remains. Can someone please help me with this ? How to get rid of the axes from the previous case ? Thanks in advance, Varun
From: Christopher on 29 Jun 2010 01:16 "Varun " <var3161(a)yahoo.co.in> wrote in message <i0a8kg$sa2$1(a)fred.mathworks.com>... > Hi All, > > I have built a Matlab GUI programmatically that displays multiple figures using 'Axes' and 'Text Box' and a 'Popup Menu'. I use the switch case in order to display images of different series. After creating an axes I use the imshow function to display the images. > > So for example, in one case 21 images need to be displayed while in another case 16. I create the axes in the popup menu callback function. > The problem is like if I switch from the case of 21 images to 16 images, the last 5 images of the previous case is still present and not removed. I have tried delete(AxesHandle) function but the image still remains. > > Can someone please help me with this ? How to get rid of the axes from the previous case ? > > Thanks in advance, > Varun Creating a number (and a large one at that) of axes each time a condition is analysed seems a slow way to do it. But anyway... I'm not sure how the delete(handles.axesTag) works in the scheme of things. Presumably it should remove it but ensure that you are updating the handles structure each time with: guidata(hObject,handles); Alternatively, I would suggest that you create a fixed number of axes on startup of the program - your maximum amount of axes perhaps - let's say 25. Now lets say you have 16 images to display - display them on the first 16 axes and "remove" the remaining 9 axes from the users view by making them invisible with: % determine number of images - numImages % put your axesHandles into an array for convenience handlesArray = {handles.axes1, handles.axes2, ... , handles.axes25}; % for each axes up to and including numImages, make visible and display respective % image for i = 1:numImages set(handlesArray{i},'visible','on'); imshow(image(i),'Parent',handlesArray{i}); end % set the remainder invisible for i = numImages+1 : length(handlesArray) set(handlesArray{i},'visible','off'); end % update handles structure guidata(hObject,handles);
|
Pages: 1 Prev: Regarding reading data from excel sheet Next: names of the figures |