フィルターのクリア

Opening an GUI real time

2 ビュー (過去 30 日間)
Thulasi Durai Durai Samy
Thulasi Durai Durai Samy 2012 年 4 月 30 日
Hi
I would like to open a GUI from another GUI. The name of existing GUI is 'first.fig'. The GUI needs to call 'a.fig' with some datas passing to second GUI.

採用された回答

Geoff
Geoff 2012 年 4 月 30 日
You should also have an m-file associated with these figures. I will assume that you created these GUIs using GUIDE.
To invoke the figure called 'a', just use that exact name:
a
To pass data to it, just pass it like you would any function:
a( {'some', 'cell', 'data'}, 42, rand(3,3) );
If you open the file a.m, you'll see a function called a_OpeningFcn. The fourth parameter is varargin, which will contain the 3 values I just passed in my example above. You can store these in your GUI just as you would normally.
GUIDE will pass any supplied data into this opening function when the GUI is initialised. So all you need to do is write the code to handle it as you please.
So edit the code for first.m, and put the call to your 'a'-GUI in the desired place, along with the data you intend to pass.
  2 件のコメント
Thulasi Durai Durai Samy
Thulasi Durai Durai Samy 2012 年 4 月 30 日
Hello Thanks for your reply.
MATLAB shows warrning "Warning: The input to STR2FUNC "10" is not a valid function name. This will generate an error in a future release".
I am passing a value '10' by the following command which is typed in the edit2 box.
a(get(handles.edit2,'String'));
Geoff
Geoff 2012 年 4 月 30 日
Is that the line of code that the warning is generated on? Put a breakpoint there and work out whether there is a variable called 'a' preventing your function called 'a' from being seen. Perhaps it's your 'get' call (something wrong with the handle?). When your program execution breaks, you can experiment in the command window to see what causes the error. You can also look at the workspace window to see what variables are in scope.

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeInteractive Control and Callbacks についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by