Borrar filtros
Borrar filtros

Setting plot axes limits via another gui window

2 visualizaciones (últimos 30 días)
Jerzy
Jerzy el 1 de En. de 2019
Respondida: Image Analyst el 1 de En. de 2019
Hi everyone!
I have a gui related problem. I have created main plot in first window. Via this window i open auxilliary window to change figure axes limits, using caxis function. I pass handles structure from main window to second window and use it to recieve Axes object and pass it as first argument of caxis:
caxis( get(mainwindow_handles.figure1,'CurrentAxes') , [min max] );
Then error occurs: Function 'subsindex' is not defined for values of class 'matlab.graphics.axis.Axes'.
In main window I do it without first argument:
caxis( [min max] );
and everything works fine.
Is there a possibility to handle it easily? I use plot and imagesc for plotting data.

Respuestas (1)

Image Analyst
Image Analyst el 1 de En. de 2019
See the FAQ:
Sharing between multiple GUIs. If the "main" GUI calls other GUIs, then the best way to do it is by passing variables in via the input argument list, and accepting output variables via the output argument list. The output argument of GUI2 can then be sent into GUI3. So someplace in GUI1 (like the callback function of the "Go!" button of GUI1), you'd have this
[out2a out2b out2c] = gui2(in2a, in2b, in2c, in2d);
[out3a out3b] = gui3(out2a, out2b);
or something along those lines. The arguments can be extracted out of the varargin cell array of your opening code for the GUI, for example in the GUI's "OpeningFcn" function if you used GUIDE. Once they are in your opening function, then they can be shared amongst the other functions in the GUI with the methods mentioned earlier in this section. This method will not let GUI1 control GUI2 and GUI3's parameters "live" - they can be changed only when calling the GUIs. To have GUI1 control GUI2 when GUI2 is already running, you can use the assignin() function.
This answer from Geoff Hayes in the Answers forum may also help you in the multiple GUI situation: [3]

Categorías

Más información sobre Graphics Performance en Help Center y File Exchange.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by