It shows Error in my GUI...

1 次查看(过去 30 天)
Lalit Patil
Lalit Patil 2013-2-21
Error= num2str(err)
if Error(1) > 0.10000
L = 'Fail.';
set(handles.text15,'string',L);
else
L = 'Pass';
set(handles.text15,'string',L);
end
This is my program -
First In command window i am getting this answer in two lines and i want to use second, but every time it will not give two answers, but whatever the number is, i want to use last,
Error =
0.091683 0.085897
But in GUI it always shows Fail.. Why..?

回答(1 个)

Walter Roberson
Walter Roberson 2013-2-21
You are converting "err" to a string, and then comparing the string to the numeric value 0.10000. Why are you not comparing err instead of Error?
  3 个评论
Image Analyst
Image Analyst 2013-2-23
编辑:Image Analyst 2013-2-23
That doesn't make sense. What Walter asked is why you don't simply do this:
if err(2) > 0.10000
L = 'Failed';
else
L = 'Passed';
end
set(handles.text15,'string',L);
Lalit Patil
Lalit Patil 2013-2-23
编辑:Lalit Patil 2013-2-23
If i tale only
err > 0.10000
then it takes first value of err and then works correctly, but
Currently i know in answer of err that there are two values so i can take
err(2) > 0.10000
But each time i will not know. Some time there will be 3 values or some time there will be 4.. So, i want to do such that whatever the number of values, i have only to take last..
So, i may have to apply any counting mechanism or any thing else and how..?

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Logical 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by