popup menu callback not plotting graph

3 ビュー (過去 30 日間)
H.Hogarth
H.Hogarth 2016 年 4 月 14 日
回答済み: Walter Roberson 2016 年 4 月 14 日
Hi, so this is only the start of my design and i wanted to test if the data stored in the dropdown menu is plotted.
However when i run the code and select a item from the dropdown menu nothing is plotted, there are no error codes or anything. Here is my code below:
function liquids_Callback(hObject, eventdata, handles)
% hObject handle to liquids (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
switch get(handles.liquids,'Value')
case 1
S.A=8.021;
S.B=1936.01;
S.C=258.451;
S.Tmin=18;
S.Tmax=118;
S.T=S.Tmin:((S.Tmax-S.Tmin)/100):S.Tmax;
case 2
S.A=8.021;
S.B=1936.01;
S.C=258.451;
S.Tmin=18;
S.Tmax=118;
S.T=S.Tmin:((S.Tmax-S.Tmin)/100):S.Tmax;
case 3
S.A=7.11714;
S.B=1210.595;
S.C=229.664;
S.Tmin=-13;
S.Tmax=55;
S.T=S.Tmin:((S.Tmax-S.Tmin)/100):S.Tmax;
otherwise
P=10.^(S.A-(S.B./(S.C+S.T)))
plot(S.T,P)
end
set(handles.liquids, 'UserData', S);
The liquids_Callback section is underlined in red saying it might not be in uses, but i dont understand why it wouldnt be in use.
Many Thanks.
  2 件のコメント
Walter Roberson
Walter Roberson 2016 年 4 月 14 日
What is the Tag of the popup button?
H.Hogarth
H.Hogarth 2016 年 4 月 14 日
liquids

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

回答 (1 件)

Walter Roberson
Walter Roberson 2016 年 4 月 14 日
You are only plotting if an entry after the third one is selected. The other entries set up values in the structure S that are written to the UserData, but the UserData is not retrieved before doing the plotting.
You should put in a breakpoint at the switch statement and see if you are even getting there, and single step to see what is happening.

カテゴリ

Help Center および File ExchangeProgramming についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by