フィルターのクリア

Info

この質問は閉じられています。 編集または回答するには再度開いてください。

How to makle a error message from 3 edit boxes math.

2 ビュー (過去 30 日間)
Mikkel
Mikkel 2012 年 7 月 12 日
閉鎖済み: MATLAB Answer Bot 2021 年 8 月 20 日
Hi
Im looking for a code that makes an error message window pop out if, edit2 - edi1 ISNT EQUAL to edit3
So when I push the pushbutton and I've put edit1 = 1 and edit2 = 4 and then edit3 = 6 there should be a window message error that says it isnt equal.
And if I put edit1 = 2 edit2 = 6 and edit3 = 4. Then there shouldnt be a error message.
  1 件のコメント
Jan
Jan 2012 年 7 月 12 日
Please post the code as text, not as giantic screenshot. This has the advantage, that we could copy&paste your code to insert the solution - much more convenient for the ones, who want to create an answer to solve your problem.

回答 (1 件)

Jan
Jan 2012 年 7 月 12 日
編集済み: Jan 2012 年 7 月 12 日
function myCheck(value1, value2, value3)
if value2 - value1 ~= value3
errordlg('The values do not match', 'My error dialog');
end
Now add a call to this function to the callback(s) you want to trigger the tests. A test for NaNs by isnan might be a good idea, if one field is empty of no valid number.
Do not be surprised, when the numbers 0.3, 0.2 and 0.1 do not lead to the expected results. Due to the limited precision 0.3-0.2 does not equal 0.1 perfectly.

この質問は閉じられています。

Community Treasure Hunt

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

Start Hunting!

Translated by