📄 vnd.m
字号:
function[varargout]=vnd(varargin)% VND Number of dimensions% % N=VND(X) returns the number of dimensions of X. Unlike matlab,% which thinks that an array and a scalar both have dimension 2, VND% defines the dimension of a scalar to be zero and that of an array to% be one. Singleton dimensions are never counted. % % [N1,N2,...NM]=VND(X1,X2,...XM) returns the dimensions of multiple % input arguments. If zero or one output arguments are given, a% single row array [N1 N2 ...NM] is output. % __________________________________________________________________% This is part of JLAB --- type 'help jlab' for more information% (C) 2001, 2004 J.M. Lilly --- type 'help jlab_license' for details if strcmp(varargin{1}, '--t') vnd_test,returnendfor i=1:nargin x=varargin{i}; sx=size(x); nd(i)=length(sx)-length(find(sx==1)); varargout{i}=nd(i);endif nargout==0 || nargout==1 varargout{1}=nd;endfunction[]=vnd_testreporttest('VND', all(vnd(1,[1:10],[ [1:10]' [1:10]'])==[0 1 2]))
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -