我在 Matlab 中有这个小程序。
laMatriz.m
function k = laMatriz(X)
Y = 9;
A = zeros(X, Y);
for i=1:X
V = elVector(Y);
LimY = length(elVector);
for j=1:LimY
A(i,j) = V(j);
end
end
k = A;
end
elVector.m
function elVector = elVector(N)
%fprintf('largo de elVector %i\n', N);
elVector=1:N;
end
调用函数 laMatriz(10) 会导致此错误:
??? Input argument "N" is undefined.
Error in ==> elVector at 3
elVector=1:N;
Error in ==> laMatriz at 11
LimY = length(elVector);
为什么?我该如何解决?