I have two arrays of the same size: e0 and tmp. isequal(e0,tmp) = 1, isreal(e0) = 0, isreal(tmp) = 1. How is that possible?

1 view (last 30 days)
I have two arrays of the same size: e0 and tmp: >> isequal(e0,tmp)
ans =
1
>> isreal(e0)
ans =
0
>> isreal(tmp)
ans =
1
How is that possible?

Answers (1)

Walter Roberson
Walter Roberson on 21 Oct 2015
A = complex(5,0);
B = 5;
isreal(A), isreal(B)
isequal(A, B)
isequal() tests for equal values, not for the arrays being identical in datatype.
isreal() checks for the complex part existing, not for the complex part being non-zero.

Categories

Find more on Data Types in Help Center and File Exchange

Tags

Products

Community Treasure Hunt

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

Start Hunting!