Empty Matrix

조회 수: 5 (최근 30일)
RoJo
RoJo 2011년 5월 12일
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

채택된 답변

Sean de Wolski
Sean de Wolski 2011년 5월 12일
c = isempty(a) || isempty(b) || a>b

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Matrices and Arrays에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by