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

 Accepted Answer

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

3 Comments

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.

Sign in to comment.

More Answers (0)

Asked:

Max
on 11 Nov 2015

Commented:

on 12 Nov 2015

Community Treasure Hunt

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

Start Hunting!