what does this error mean and why cant i use the if function i use it in another function and it worked

1 回表示 (過去 30 日間)
  3 件のコメント
jana
jana 2023 年 1 月 12 日
will do heres my app designer file
Jan
Jan 2023 年 1 月 13 日
@jana: You still post your code as screen shots in following questions.
Attaching the mlapp file is less useful, if a user is working in the forum without having access to Matlab. Again: Please post the readable sourcecode of the text instead. Thanks.

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

採用された回答

Cameron
Cameron 2023 年 1 月 12 日
編集済み: Cameron 2023 年 1 月 12 日
You need to close your if statement. You can't leave it without putting "end" to signify where the if statement stops
if %some if statement
end %you need this
so put end on line 703
  4 件のコメント
jana
jana 2023 年 1 月 12 日
so it only worked for a<100 but the other way around it doesnt work
heres the code if u want to try it
Cameron
Cameron 2023 年 1 月 12 日
The purpose of your initial question was to determine why your code wasn't working. A couple of us have pointed out that it was a missing end statement. Now that it is running, you should be able to adjust it according to your needs. I don't know what you're trying to do, but I've combined some of your if statements below. If you have further questions, please create a new thread about what your new problem is.
function EditFieldValueChanged(app, event)
value = app.EditField.Value;
app.Gauge.Value=value;
app.TempEffect=app.Modified;
if value>100
a=app.Modified;
I=imshow(a>100,'parent',app.UIAxes2,...
'XData',[1 app.UIAxes2.Position(3)],...
'YData',[1 app.UIAxes2.Position(4)]);
app.UIAxes2.XLim=[0 I.XData(2)];
app.UIAxes2.YLim=[0 I.YData(2)];
I=imshow(app.Modified,'parent',app.UIAxes3,...
'XData',[1 app.UIAxes3.Position(3)],...
'YData',[1 app.UIAxes3.Position(4)]);
app.UIAxes3.XLim=[0 I.XData(2)];
app.UIAxes3.YLim=[0 I.YData(2)];
end
if value<100
a=(app.Modified);
I=imshow(a<100,'parent',app.UIAxes2,...
'XData',[1 app.UIAxes2.Position(3)],...
'YData',[1 app.UIAxes2.Position(4)]);
app.UIAxes2.XLim=[0 I.XData(2)];
app.UIAxes2.YLim=[0 I.YData(2)];
end
app.Exit=1;
end

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

その他の回答 (1 件)

Steven Lord
Steven Lord 2023 年 1 月 12 日
The end keyword on line 705 closes the if statement on line 689.
The end keyword on line 706 closes the function definition on line 685.
You cannot start a new methods block on line 709 without first closing the previous methods block (which starts somewhere above the start of the code in your picture.
Add an end statement on line 707. If you click on that end statement (or any end statement) I believe MATLAB should show you the keyword with which that end statement is associated. Similarly if you click on the methods keyword (or if or keyboard or ...) MATLAB should show you the corresponding end.

カテゴリ

Help Center および File ExchangeDevelop Apps Using App Designer についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by