MATLAB Answers

Can someone help me to see where the error is please?

21 ビュー (過去 30 日間)
Hdez
Hdez 2021 年 1 月 14 日
編集済み: Image Analyst 2021 年 1 月 14 日
Error: File: AssignmentOmaira2.m Line: 17 Column: 15
Invalid expression. When calling a function or indexing a variable, use parentheses. Otherwise, check for mismatched delimiters.
Can someone help me to identify the error, it says it is on line 17 but I can not figure it out

  0 件のコメント

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

回答 (2 件)

Cris LaPierre
Cris LaPierre 2021 年 1 月 14 日
Your conditional statemens are using an incorrect syntax. Notice the characters that are underlined in red. It looks like you forgot to keep the function with its inputs. Are you trying to do this?
while rem(lx,h)>=0 || rem(ly,h)<=0

  2 件のコメント

Hdez
Hdez 2021 年 1 月 14 日
If I do that it gives me that the solution is incorrect and therefore I have to reneter a value for h
Cris LaPierre
Cris LaPierre 2021 年 1 月 14 日
Well, that's better than what it was doing before. Now at least your code is running without errors.
Perhaps the error is in the logic that has been built into the code. Work through what it is you want your code to do, and then verify that what you have written is actually doing that.

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


Image Analyst
Image Analyst 2021 年 1 月 14 日
編集済み: Image Analyst 2021 年 1 月 14 日
I think you mean
while rem(lx,h) ~=0 || rem(ly,h) ~= 0
promptMessage = sprintf('Incorrect Solution.\nPlease enter a value that results in an integer value.\nDo you want to Continue processing,\nor Quit processing?');
titleBarCaption = 'Continue?';
buttonText = questdlg(promptMessage, titleBarCaption, 'Try again', 'Quit', 'Try again');
if contains(buttonText, 'Quit', 'IgnoreCase', true)
return;
end
% Try again.
h = input('Enter the desired grid spacing : ');
end

  0 件のコメント

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

Community Treasure Hunt

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

Start Hunting!

Translated by