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

 Respuesta aceptada

Thorsten
Thorsten el 11 de Nov. de 2015
if length(dict)=1
newguess=dict
else
%bunch of code
end

3 comentarios

Max
Max el 11 de Nov. de 2015
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 el 12 de Nov. de 2015
n = numel(dict);
Thorsten
Thorsten el 12 de Nov. de 2015
n = numel(dict);

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Preguntada:

Max
el 11 de Nov. de 2015

Comentada:

el 12 de Nov. de 2015

Community Treasure Hunt

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

Start Hunting!

Translated by