Assign figure to axes gui
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Hi everybody,
again I need your help with matlab programming: I am trying to implement a code, which is composed of several functions, into a GUI. It works fine but I have my difficulties with assigning the figures, which are created in functions, to the axes in GUI. Can anyone tell me, how to correctly assign the figure from the function to the axes? I tried to return the figure from the function into the axes handle (handles.axes1 = myfunction(bla1, bla2) ), but this one doesn't work.
Help is very appreciated, thanks in advance.
Georg
1 Kommentar
Adam
am 2 Dez. 2016
You need to give more information as it isn't obvious what you are doing.
Axes are children of a figure. You don't normally assign a figure to a pre-existing axes.
handles.axes1 = myfunction(bla1, bla2)
is not a good idea if that is in a GUIDE GUI which I assume it is given you are using handles. axes1 is the default name of the first axes created in GUIDE (though I usually change its name) and if this is the case you should never be reassigning something to it in the code.
Antworten (1)
Geoff Hayes
am 4 Dez. 2016
Georg - if your function is plotting or drawing some data on to an axes, then if you want to draw it to a specific axes (like the one from your GUI) then you should pass the handle of the axes that you wish to draw to. For example, from within your GUI code, you would call your function as
myfunction(bla1, bla2, handles.axes1);
where handles.axes1 is the handle to the axes that you wish to draw or plot the data to. You would then need to update the body of this function so that when it calls whatever MATLAB function to draw the data, you pass in the handle to the axes.
0 Kommentare
Siehe auch
Kategorien
Mehr zu Migrate GUIDE Apps finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!