sizem.m
来自「fading 在无线中的应用」· M 代码 · 共 33 行
M
33 行
function s = sizem(m, dims)% DESCRIPTION res = sizem(m, dims) % For a matrix m the size is given for each element of dims.% Dims is the dimensions for which the size is determined.% If dims is omitted then the size of all dimensions of m are delivered.% INPUT % m -- A matrix of any size.% dims -- A vector with index number to dimensions. % OUTPUT % res -- The coresponding sizes. % TRY % sizem(ones(2,3,4)) => [2 3 4]% sizem(ones(2,3,4), [2 3]) => [3 4]% SEE ALSO % size, ndimsm% by Magnus Almgren 970529s = size(m);if prod(s) == 0 s = 0;elseif length(s) == 2 & s(2) == 1 s = s(1);endif nargin > 1 if any(dims<1) error('Dimensions must be non-negative integers.') else stemp = [s 1]; s = stemp(min(length(stemp), dims)); endend
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?