IF statement not executing
古いコメントを表示
% Value changed function: ActionDropDown_2
function ActionDropDown_2ValueChanged(app, event)
if app.ActionDropDown_2.Value == "Plot"
app.Tbl = app.UITable2.Data(:,{'DATE', 'AVAILABILITY'});
app.X = app.UITable2.Data(:,3);
app.Y = app.UITable2.Data(:,31);
plot(app.UIAxes,app.X,app.Y)
end
end
The callback function operates as expected, once called, the debug arrow reaches breakpoint of the IF statment line but once I chose to "Continue" the debug arrow jumps straight to END. Not executing any of the following lines to define Tbl, X, or Y and no plot.
6 件のコメント
shnrndll
2022 年 1 月 5 日
Voss
2022 年 1 月 5 日
Seems like app.ActionDropDown_2.Value is not equal to "Plot".
shnrndll
2022 年 1 月 5 日
Cris LaPierre
2022 年 1 月 5 日
The code is syntatically correct, and you are not getting any errors. The issue is that the condition evaluates as false, so the code inside the statement does not get run.
shnrndll
2022 年 1 月 5 日
Walter Roberson
2022 年 1 月 5 日
Put a breakpoint at the if. When you arrive there, command
class(app.ActionDropDown_2.Value)
if char(app.ActionDropDown_2.Value)
disp('char')
disp(double(app.ActionDropDown_2.Value))
elseif isstring(app.ActionDropDown_2.Value)
disp('string')
disp(double(app.ActionDropDown_2.Value{1}))
else
disp('other')
disp(app.ActionDropDown_2.Value)
end
and tell us what the output is.
This is not intended as permanent code: it is only intended to help debug the problem.
採用された回答
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Develop Apps Using App Designer についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!