フィルターのクリア

Sharing Data between two GUIs

1 回表示 (過去 30 日間)
John
John 2011 年 9 月 27 日
I basically have one main GUI that is calling for a smaller GUI which simply contains clear check boxes. What I want to do is be able to obtain the data informing me which check box is checked and which one is not in my main GUI. I have tried the following already:
function progselec_opt_SelectionChangeFcn(hObject,eventdata)
%retrieve GUI data, i.e. the handles structure
handles = guidata(hObject);
set(handles.step1txt,'BackgroundColor',[1 0 0]);
set(handles.updatestatus_txt,'BackgroundColor',[1 0 0],'String','UPDATE REQUIRED');
switch get(eventdata.NewValue,'Tag')
case 'allprog_radbut'
case 'specprog_radbut'
acoustic_programs %Summons second GUI
end
acoustic_programsFigureHandle = acoustic_programs;
acoustic_programsData = guidata(acoustic_programsFigureHandle);
get(acoustic_programsData.quetzsat_checkbx,'Value') %Get the value of one of the check boxes
guidata(hObject, handles);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
This however gives the value of the checkbox before it was even checked, in other words my output is only zero. Please help

採用された回答

Walter Roberson
Walter Roberson 2011 年 9 月 27 日
Getting the Tag of eventdata.NewValue only makes sense if this callback is the callback of a button-group.
If the NewValue Tag is 'specproc_radbut' then you run acoustic_programs within the switch. And then, either way, after the switch, you run acoustic_programs again, this time recording the handle. Depending on how acoustic_programs is coded, the GUI for the first run might not be the same gui as for the second run, or running again could re-initialize the boxes.
Note: your code does not change any value in handles, so it does not need to store handles with your final guidata() call.
  3 件のコメント
Walter Roberson
Walter Roberson 2011 年 9 月 27 日
In the code you have, you launch the second gui, but you do not give any time for the user to do anything before you check the status of the checkbox.
Perhaps you would like to
waitfor(acoustic_programsData.quetzsat_checkbx,'Value')
http://www.mathworks.com/help/techdoc/ref/waitfor.html
John
John 2011 年 9 月 28 日
Thank you so much for the help, waitfor was the command I needed. This is my first time making a GUI so learning alot. Thanks!

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeGet Started with MATLAB についてさらに検索

タグ

製品

Community Treasure Hunt

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

Start Hunting!

Translated by