??? Error using ==> mtimes为什么
function fout=charray(a,b,c)if nargin==1
fout=a;
elseif nargin==2
fout=a+b;
elseif nargin==3
fout=(a*b*c)*0.5;
end
以examp命名的程序
运行下面的x=1:3;
y=;
examp(x)
examp(x,y)
examp(x,y,3)
时候
结果是这样的: ans =
1 2 3
ans =
2 4 6
??? Error using ==> mtimes
Inner matrix dimensions must agree.
Error in ==> examp at 7
fout=a*b*c*0.5; fout=(a.*b*c)*0.5
要点乘
页:
[1]