popup menu callback not plotting graph

조회 수: 5 (최근 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 CenterFile Exchange에서 Programming에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by