exiting code if condition is met

I have written a bunch of code but I would like to ignore it if and a condition is met. so for
if length(dict)=1
newguess=dict
end
%bunch of code
I want to ignore all that code if my if statement is met and just stop if length(dict)=1

 採用された回答

Thorsten
Thorsten 2015 年 11 月 11 日

0 投票

if length(dict)=1
newguess=dict
else
%bunch of code
end

3 件のコメント

Max
Max 2015 年 11 月 11 日
thanks just a follow up question how do i find the length of a cell. say dict={'aa';'aal';'aalii';'aam';'aani'} dict has 5 words in it how do I find when it has just one for an if statement.
Thorsten
Thorsten 2015 年 11 月 12 日
n = numel(dict);
Thorsten
Thorsten 2015 年 11 月 12 日
n = numel(dict);

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

その他の回答 (0 件)

カテゴリ

質問済み:

Max
2015 年 11 月 11 日

コメント済み:

2015 年 11 月 12 日

Community Treasure Hunt

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

Start Hunting!

Translated by