Matrix Logical Indexing in If...else... construction

2 visualizaciones (últimos 30 días)
How i can do condition then if in my array varargin{j} at least one logical '1' is exist, condition works?
example
elseif varargin{j} == inf | varargin{j} == 0 | varargin{j} < 0
error(..)

Respuesta aceptada

Thiago Henrique Gomes Lobato
Thiago Henrique Gomes Lobato el 15 de Dic. de 2019
If you wanna check that a condition happens at least one time in an array you can use "any"
elseif any(isinf(varargin{j})) || any(varargin{j} <= 0)

Más respuestas (0)

Categorías

Más información sobre Matrices and Arrays en Help Center y File Exchange.

Productos


Versión

R2016b

Community Treasure Hunt

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

Start Hunting!

Translated by