Prev: lscov vs \
Next: Renderer: Painters. export_fig
From: Henrik on 25 May 2010 04:56 Hello, I created a GUI using Matlab GUIDE do read in data from Excel files. The Excel file's header is passed to a listbox from which the user can select multiple entries and pass them to two other listboxes called x-Axis and y-Axis. The user can select a pair of x-Axis and y-Axis data and hit a pushbutton to plot the selected dataset. All figures' names are stored in a fourth listbox. The goal is to enable the user to read several excelfiles subsequently and to create several plots. In addition it is essential to enable the user to plot datasets from different exelfiles to one figure. So the user should be able to choose an existing figure from the fourth listbox and then hit the plot button to plot the currently selected dataset to the selected figure. The problem is to keep track of the figures the user creates. When the user decides to close a figure by hitting "X"-button the closerequestfcn is called. The closerequestfcn has to tell the fourth listbox that the just closed figure no longer exists and delete that figure's name from the listbox. My first guess was to customize the closerequestfcn: figure('closerequestfcn', @my_closerequest) Unfortunately, customized closerequestfcns do only accept two inputs src and event. So it seams there is no way to pass the handles to the customized closerequestfcn. Next step was to try to pass the handles by using guidata... without success. So the question is: Is there a way to edit the handles struct within the closerequestfcn or in other words to pass the handles to the closerequestfcn? Thanks for your help, Henrik
From: Walter Roberson on 25 May 2010 10:02 Henrik wrote: > figure('closerequestfcn', @my_closerequest) > > Unfortunately, customized closerequestfcns do only accept two inputs src > and event. So it seams there is no way to pass the handles to the > customized closerequestfcn. Not correct: customized callbacks can take as many arguments as you want after the src and event: figure('Closerequestfcn', {@my_closerequest, TheHandle}) function my_closerequest(src, event, TheHandle) ..... end
From: Henrik on 25 May 2010 10:34 Walter Roberson <roberson(a)hushmail.com> wrote in message <TLQKn.44522$gv4.14869(a)newsfe09.iad>... > Henrik wrote: > > > figure('closerequestfcn', @my_closerequest) > > > > Unfortunately, customized closerequestfcns do only accept two inputs src > > and event. So it seams there is no way to pass the handles to the > > customized closerequestfcn. > > Not correct: customized callbacks can take as many arguments as you want > after the src and event: > > figure('Closerequestfcn', {@my_closerequest, TheHandle}) > > function my_closerequest(src, event, TheHandle) > .... > end The solution submitted by Walter works fine. Many thanks.
|
Pages: 1 Prev: lscov vs \ Next: Renderer: Painters. export_fig |