if else condition - empty vector

5 visualizaciones (últimos 30 días)
aurc89
aurc89 el 21 de Ag. de 2014
Comentada: aurc89 el 21 de Ag. de 2014
Hello, I have a doubt on this code:
x = []
if x == []
a=3
else
a=4
end
I don't understand why it always returns a = 4, even if x is an empty vector. How shall I modify it to obtain a right condition on x ? Thanks

Respuesta aceptada

Robert Cumming
Robert Cumming el 21 de Ag. de 2014
help isempty

Más respuestas (0)

Categorías

Más información sobre Loops and Conditional Statements en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by