Multiple fig files into one GUI with Tabs.
Ältere Kommentare anzeigen
Good Afternoon All,
I have created three different .fig files in matlab Guide and want to combine them into a single GUI with tabs. I understand how Guide works but when looking at others who wrote out tab codes without guide I am lost. Is it possible to use the .fig files (or the accompanying m files with them) and place them into a single GUI with tabs?
I have the Introduction tab which I am assuming will be my main GUI and then have two tabs for Input and Results. I am going to be passing the Input screen information to the Results tab for calculations. Any suggestions?
Any help is very much appreciated.
Thanks,
Mel
1 Kommentar
Ka Mirul
am 15 Okt. 2017
Is your problem solved? I found a nice brief explanation to create multi Tab GUI, hope this help you https://www.youtube.com/watch?v=d3-kd4HUtic
Antworten (4)
Sean de Wolski
am 6 Sep. 2012
Bearbeitet: Sean de Wolski
am 6 Sep. 2012
1 Stimme
No. Unfortunately *.fig files cannot be children of other *.fig files.
If you wish to use tabbing you will have to emulate the *.fig files in uitabs or uipanels to navigate between them.
If you don't want to have to rewrite those GUIs, you could have them be pop-ups from the main gui. I.e. the main gui opens the sub-gui which pass information back and forth as necessary.
4 Kommentare
Melissa
am 7 Sep. 2012
Sean de Wolski
am 7 Sep. 2012
Bearbeitet: Sean de Wolski
am 7 Sep. 2012
Basically, when you push a button that says "Input stuff" it runs the *.m file for the input gui. If the input GUI needs information from the main GUI, this is passed in this call, e.g.:
function inputbutton_callback(hObject,eventdata,handles)
inputGUI(handles,pi) %give it access to handles and pi
Then in that GUI's closeRequestFcn save any new information to the original GUI.
Vimanyu Aggarwal
am 11 Apr. 2013
Sean de Wolski : I have a similar problem.In the inputGUI , I have a static textbox (which displays the result of a calculation done in that inputGUI). I want to copy that result and get it displayed as a static text in my original GUI. Please tell how can I link the output of two static textboxes in two different GUIs? Also, Thank you for your code. It really helped me.
Vimanyu Aggarwal
am 11 Apr. 2013
Correction : When I say inputGUI, and original GUI.. I am referring to two different FIG files.
per isakson
am 7 Sep. 2012
Bearbeitet: per isakson
am 7 Sep. 2012
Search the File Exchange.
Its description says:
- No programming is necessary!
- All tabpanels can be edited comfortably with GUIDE!
- All MATLAB UI controls are supported.
- result is the original FIG-file and the accompanying M-file which
is automatically extended with callbacks
- No ActiveX or JAVA components are used!
.
Did you study the
function h = uitabgroup(varargin)
% This function is undocumented and will change in a future release
.
It will probably turn out that you have to create your GUIs programmatically or give up tabbed panels and more.
4 Kommentare
Melissa
am 7 Sep. 2012
Sean de Wolski
am 7 Sep. 2012
Bearbeitet: Sean de Wolski
am 7 Sep. 2012
Melissa, (a probably not good idea:) if your GUI's are all the same size and (fixed) you could just have all three open and change the visibility/focus of them. I.e. when GUI1 has focus, its 'visible' property is 'on' and the other's are 'off'. Pushing one of the tabs, turns that GUI' 'visible off' and another one on while giving it focus.
Depending on how many controls/etc you have, it might just be worth it to copy it over into tabbed panels like with the FEX entry.
Melissa
am 7 Sep. 2012
Sean de Wolski
am 7 Sep. 2012
Yes. Just like you would call it from the command line.
Vimanyu Aggarwal
am 11 Apr. 2013
0 Stimmen
A more easier way to do this is by making panels in GUIDE and locating all your components on the panels. Turning the visibility of panel changes the visibility of all the components on the panels. Then just paste all your panels in the main file with intro/input buttons/results. Only one fig file needed !
Jan
am 11 Apr. 2013
You can dock several figures in one figure group:
desktop = com.mathworks.mde.desk.MLDesktop.getInstance;
myGroup = desktop.addGroup('myGroup');
desktop.setGroupDocked('myGroup', 0);
myDim = java.awt.Dimension(5, 2);
desktop.setDocumentArrangement('myGroup', 2, myDim)
figH = zeros(1, 10);
for iFig = 1:10
figH(iFig) = figure('WindowStyle', 'docked', ...
'Name', sprintf('Figure %d', iFig), 'NumberTitle', 'off');
set(get(handle(figH(iFig)), 'javaframe'), 'GroupName', 'myGroup');
end
But this method is not documented and can be changed with the Matlab releases. The shown version works with 2009a and perhaps other versions also. A similar method would allow to create two docked figures, with one is the "tab-panel" and the other shows the selected figure.
My opinion: This is nice for playing and it demonstrates the power Matlab's GUI could have, when TMW decides to implement documented interfaces to it. But until then, I strongly recommend not to use such tricks for productive work.
Kategorien
Mehr zu Scripts finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!