GUI by code dynamic
Ältere Kommentare anzeigen
Hi,
I'm a beginner in creating GUI by code and I want to create something dinamic. I've create a excel file where I put all the property of the object that I have to plot in the GUI and then by code I create them because at the end they are going to be several object and I don't want to create il all manually one by one.
In the code I have put a condition that recognize the type of object and plot it with his specific property, but I can't make the same with the parent option. What do I have to put where there are the ???
Thank you Here is the code and the excel table:
switch Values{g,ind(2)} % rileva la tipologia dell'oggetto
case 'figure'
eval([Values{g,ind(3)} '= figure(''Name'',Values{g,ind(5)},''Position'',[Values{g,ind(6)} Values{g,ind(7)} Values{g,ind(8)} Values{g,ind(9)}])'])
case 'tab_group'
eval([Values{g,ind(3)} '= uitabgroup(''Parent'', ???,''Position'',[Values{g,ind(6)} Values{g,ind(7)} Values{g,ind(8)} Values{g,ind(9)}])'])
end

1 Kommentar
Stephen23
am 23 Mai 2016
Using eval to access these variables is going to be very buggy and slow to run, as has been explained many times on this forum:
Akzeptierte Antwort
Weitere Antworten (1)
Geoff Hayes
am 23 Mai 2016
1 Stimme
Elando - using eval is generally discouraged as it leads to code that is difficult to trouble shoot whenever a bug arises. In this case, I understand why you are doing it this way as you are trying to build a GUI from an Excel file that you can presumably make changes to and then run your code that will build the newly designed GUI.
So, the parent of your tgroup is Main_fig, or Values{g,ind(4) which you should be able to use in place of the ??? in the above code.
1 Kommentar
Kategorien
Mehr zu Data Import from MATLAB 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!
