Effacer les filtres
Effacer les filtres

Empty Matrix

4 vues (au cours des 30 derniers jours)
RoJo
RoJo le 12 Mai 2011
I am wondering if there is a way to convert an empty matrix to zero without doing an if statement testing for isempty?
My problem is comparing two values when the find function returns an empty matrix for one of them.
I would like the answer c to be 1 , not an empty matrix
A = ones(5, 1)
B = zeros(5, 1)
a = find(A, 1, 'first')
b = find(B, 1, 'first')
c = a > b
c =
Empty matrix: 0-by-1

Réponse acceptée

Sean de Wolski
Sean de Wolski le 12 Mai 2011
c = isempty(a) || isempty(b) || a>b

Plus de réponses (0)

Catégories

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

Community Treasure Hunt

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

Start Hunting!

Translated by