SUNY Geneseo Department of Mathematics
Monday, May 2
Math 230 02
Spring 2016
Prof. Doug Baldwin
isequal
function>> x = 1; y = 4;
>> x == y
ans =
0
>> z = 4;
>> y == z
ans =
1
>> r = 'abcd'; s = 'xyz'; t = 'xyz';
>> r == s
Error using ==
Matrix dimensions must agree.
>> strcmp( r, s )
ans =
0
>> strcmp( s, t )
ans =
1
>> strcmp( s, x ) % Surprising that strcmp works between a string and number at all
ans =
0
>> isequal( x, y )
ans =
0
>> isequal( y, z )
ans =
1
>> isequal( r, s )
ans =
0
>> isequal( s, t )
ans =
1
>> % isequal even works on entire cell arrays
>> isequal({1,'hello'}, {2,'hello'} )
ans =
0
>> isequal( {1,'hello'}, {1,'hello'} )
ans =
1
(No Next Lecture)