function out = classify(x)
[n m] = size(x);
if nargin==1
if n==0 || m==0
out=-1;
elseif n==1 && m==1
out=0;
elseif n==1 && m>1
out=1;
elseif m==1 && n>1
out=1;
%elseif n>1 && m>1
%out=1;
else
out=2;
end
else
out=2;
end
Search Program on this blog
Friday, 6 November 2015
Write a function called classify that takes one input argument x. That argument will have no more than two dimensions. If x is an empty matrix, the function returns -1. If x is a scalar, it returns 0. If x is a vector, it returns 1. Finally, if x is none of these, it returns 2. Do not use the built-in functions isempty, isscalar, or isvector.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment