フィルターのクリア

Get Values from other m.file via dropdown

2 ビュー (過去 30 日間)
Aj
Aj 2017 年 11 月 16 日
編集済み: Stephen23 2017 年 11 月 25 日
In one m.file is a simple gui with a popupmenu with 4 options (C25,C35,C45,C55); In the second m.file is:
%C25
Rm=500;
Rp=600;
%C35
Rm=800;
Rp=900;
%C45
Rm=1000;
Rp=1100;
%C55
Rm=1200;
Rp=1300;
Now i need help: If i pick in the popupmenu C25, it should search "C25" in the second sheet and bring me the Values Rm=500 and Rp=600 to the First m.file. I dont know, how it works and i really need help, cause I am a matlab Rookie.
Thanks for the help. Best Regards AJ
  4 件のコメント
Stephen23
Stephen23 2017 年 11 月 16 日
Aj
Aj 2017 年 11 月 16 日
well, thank you for that. But now how i can load the variables dependent to popupmenu. When i choose C25, it need to give Rm=500 back and when i choose C35, then it need to give Rm=800 back.

サインインしてコメントする。

採用された回答

Stephen23
Stephen23 2017 年 11 月 16 日
One easy way would be to store the data in a structure:
S.C25.Rm = 500;
S.C25.Rp = 600;
S.C35.Rm = 800;
S.C35.Rp = 900;
S.C45.Rm = 1000;
S.C45.Rp = 1100;
S.C55.Rm = 1200;
S.C55.Rp = 1300;
save('test.mat','-struct','S')
And then to access that data from the file:
name = 'C35';
S = load('test.mat',name);
S = S.(name);
S.Rp
S.Rm

その他の回答 (1 件)

ali fadaie
ali fadaie 2017 年 11 月 24 日
編集済み: Stephen23 2017 年 11 月 25 日
i think code corect
S.C25.Rm = 500;
S.C25.Rp = 600;
S.C35.Rm = 800;
S.C35.Rp = 900;
S.C45.Rm = 1000;

カテゴリ

Help Center および File ExchangeWorkspace Variables and MAT-Files についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by