octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Help with ismatrix compatibility testing


From: Kai Torben Ohlhus
Subject: Re: Help with ismatrix compatibility testing
Date: Wed, 28 May 2014 00:31:40 +0200

On Wed, May 28, 2014 at 12:19 AM, Rik <address@hidden> wrote:
5/27/14

Octave has had the ismatrix() command since 2002, but Matlab added one in
2010 and it doesn't appear that the two are exactly the same.

Could someone with a recent edition of Matlab (>2010) run the following and
report the results.

It might be easiest to use "diary on", run the commands, and then "diary
off" and upload the file since there are quite a few tests.

Commands to run:

ismatrix ({1,2;3,4})
[x(1:2,1:2).a] = deal (1,1,1,1);
ismatrix (x)
ismatrix ([])
ismatrix (zeros (10, 0))
ismatrix (zeros (0,10))
x = zeros (0,10,0,0,0)
size (x)
ndims (x)
ismatrix (x)
x = zeros (0,10,0,1,0)
ismatrix (x)
isscalar ({1})
isvector ([])
isvector (1)
isvector (zeros (1,0))
isvector (cell (1,3))

Thanks,
Rik


For MATLAB R2013b the result is:

>> ismatrix ({1,2;3,4})
ans =
     1

>> [x(1:2,1:2).a] = deal (1,1,1,1);
>> ismatrix (x)
ans =
     1

>> ismatrix ([])
ans =
     1

>> ismatrix (zeros (10, 0))
ans =
     1

>> ismatrix (zeros (0,10))
ans =
     1

>> x = zeros (0,10,0,0,0)
x =
   Empty array: 0-by-10-by-0-by-0-by-0

>> size (x)
ans =
     0    10     0     0     0

>> ndims (x)
ans =
     5

>> ismatrix (x)
ans =
     0

>> x = zeros (0,10,0,1,0)
x =
   Empty array: 0-by-10-by-0-by-1-by-0

>> ismatrix (x)
ans =
     0

>> isscalar ({1})
ans =
     1

>> isvector ([])
ans =
     0

>> isvector (1)
ans =
     1

>> isvector (zeros (1,0))
ans =
     1

>> isvector (cell (1,3))
ans =
     1

Best,
Kai

reply via email to

[Prev in Thread] Current Thread [Next in Thread]