popup menu callback not plotting graph

3 visualizzazioni (ultimi 30 giorni)
H.Hogarth
H.Hogarth il 14 Apr 2016
Risposto: Walter Roberson il 14 Apr 2016
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.

Risposte (1)

Walter Roberson
Walter Roberson il 14 Apr 2016
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.

Categorie

Scopri di più su Programming in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by