GUI by code dynamic
古いコメントを表示
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 件のコメント
Stephen23
2016 年 5 月 23 日
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:
採用された回答
その他の回答 (1 件)
Geoff Hayes
2016 年 5 月 23 日
1 投票
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 件のコメント
カテゴリ
ヘルプ センター および File Exchange で Data Import from MATLAB についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
