Create a Message Box with a condition

1 回表示 (過去 30 日間)
Inês Mendes
Inês Mendes 2015 年 6 月 11 日
回答済み: Nobel Mondal 2015 年 6 月 11 日
Hi guys,
I have a question. I am trying to create a msgbox with a condition and i don´t know why but it isn´t working..
I have a script that returns a vector x.
I want to create a msgbox that says "fault" if any of the values in x<10 for example.
The thing is that the cycle i created isn´t working and only analyses the first value of the vector...
Can you help?
I would be much appreciated!
Inês

回答 (1 件)

Nobel Mondal
Nobel Mondal 2015 年 6 月 11 日
x = 5:25; % Input Vector
limit = 10;
if ~isempty(find(x<limit,1))
msgbox('Fault');
else
% Do Something Else
msgbox(['Everything >= ' num2str(limit)]);
end

カテゴリ

Help Center および File ExchangeDynamic System Models についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by