问题
I have this matlab GUI (not made by me of course), and I have been looking everywhere for almost about a week on how I can possibly extract the figures from it to no success. I am at my wits end and was wondering if any one could help?
I want to be able to copy the figure (and save to desktop to extract data from after), or copy the data in a form of a matrix that I can manipulate and save. I thought I'd put the GUI here in case anyone wants to give it a shot and help (I'd be willing to paypal someone cash if they can help me!):
http://www.mediafire.com/?vqxymayztac3bvp
This is how you produce the image:
- open spec_gui
- click file, open, select FocusedInfinity.mat
- press "Calculate"
- push buttons
A."XY Profile" & "DimSum" with Elem slider set to "1"
B."XY Profile" & "DimSum" with Elem slider set to "5"
- the top window will display an image:

回答1:
Here's how I'd attack this.
- Open the figure in GUIDE.
That opens the GUIDE editor like so:
Right click on the Calculate button and look at the
Property Inspector
.Then you can look at the properties, look for
Callbacks
of any type that are defined.Click the
Callback
worksheet with a pencil icon and it brings up the editor withspec_gui.m
and thecalcbtn_Callback
.% --- Executes on button press in calcbtn. function calcbtn_Callback(hObject, eventdata, handles) h=handles.param; h.nu=linspace(h.extfreq(1),h.extfreq(2),h.n_freq); [handles.pList,handles.data]=speccalc('nfile','temp','spec',h.spec, ... 'gamma',h.gamma,'ng',h.n_mode,'nu',h.nu,'np',h.n_r,'silent',1, ... 'dim',1:h.n_dim,'m',h.m','cart',h.cart); handles.file='temp.mat'; handles=update_data(hObject, [], handles); update(hObject, [], handles);
This is what calculates the figure, you can repeat this process to see what the "XY Profile" & "DimSum" and Elem slider callbacks are and what they do. It'll be a little bit of work, but you'll get it. Otherwise SO is here to help. :-)
回答2:
OK I DID IT!
With a combo of what MACDUFF and DANGKHOA (thanks so much guys) said and a few hours later!
I found out which line in the code the buttons are being utilized (ie what MAC DUFF said)
I put a "keyboard" right after, but before the end of the code (ie what DAN KHOA said)
When I started the GUI and calculation and pressed the button the matlab script displayed "k"
I typed in figure
then "imagesc(im)", which "im" was what the GUI was saving the image data as.
BINGO! Thanks guys...so much work sigh

来源:https://stackoverflow.com/questions/17237381/how-to-extract-data-figure-from-gui-matlab