How can use "is not equal to" command in matlab? and how terminate or cancel if else??

 Respuesta aceptada

E.g.,
if( length(a) ~= length(b) || length(c) ~= length(a) )
% terminate
end
For the terminate statement, you need to be more clear. If you are terminating a loop of some sort, then
break;
If you are terminating a function with an error return, then
error('Lengths are not equal');
If termination means something else, then you need to tell us.

1 comentario

Then use the error function as shown above. E.g.,
if( length(a) ~= length(b) || length(c) ~= length(a) )
error('Error- dimensions of array is not equal');
end
If the error is not handled by a try-catch, then this will terminate the program with an error statement.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Productos

Etiquetas

Preguntada:

el 4 de Nov. de 2015

Comentada:

el 4 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