Effacer les filtres
Effacer les filtres

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

2 vues (au cours des 30 derniers jours)
Pavel M
Pavel M le 15 Déc 2019
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(..)

Réponse acceptée

Thiago Henrique Gomes Lobato
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)

Plus de réponses (0)

Catégories

En savoir plus sur Matrices and Arrays dans Help Center et File Exchange

Produits


Version

R2016b

Community Treasure Hunt

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

Start Hunting!

Translated by