try
surf
catch ME
disp(['ID: ' ME.identifier])
rethrow(ME)
end
ID: MATLAB:narginchk:notEnoughInputs
Error using surf (line 49)
Not enough input arguments.
在您的工作文件夹中创建一个函数 combineArrays。
function C = combineArrays(A,B)
try
C = catAlongDim1(A,B); % Line 3catch exception
throw(exception) % Line 5endendfunction V = catAlongDim1(V1,V2)
V = cat(1,V1,V2); % Line 10end
调用数组大小不同的 combineArrays 函数。
A = 1:5;
B = 1:4;
combineArrays(A,B)
Error using combineArrays
Dimensions of matrices being concatenated are not consistent.
Error using cat
Dimensions of matrices being concatenated are not consistent.
Error in combineArrays>catAlongDim1
V = cat(1,V1,V2);
Error in combineArrays
C = catAlongDim1(A,B);