⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 getm2.m

📁 matlab阵列信号处理工具箱
💻 M
字号:
function Matrix = getm2(multiMatrix, ix1, ix2, ix3, ix4, ix5, ix6)% RECVAR, A package for new data types in Matlab 4. % (c) FOA 1997. See the file rvright.m for copyright notice.%%  function Matrix = getm2(multiMatrix, ix1, ix2, ix3, ix4, ix5, ix6)%%  Gets a two dimensional matrix from a part of a multidimensional matrix %  (multimatrix). Behavoir as Matlab 5.%%  Matrix       A normal 2D Matlab matrix.%  multiMatrix  MultimatrixT%  ix1, ix2, ix3, ix4, ix5, ix6: Index/subscript (integer row vectors or ':').%%  The first dimension whose index/subscript is a vector becomes different rows in the%  output matrix 'Matrix'.%  Note that when the output matrix is a vector, it will always be a row vector%  except for when ix2 is vector.%%  This function differs from the function getm in that way that getm2%  returns the same output matrix as squeeze(A(...)) in Matlab 5.%  The only difference is when ix2 is a vector and all other index %  variables are scalars.%%  The indexnumber/subscriptnumber ':' can be used to denote all elements%  in a dimension.%%  Ex:%     b = getm(A, 1, 3:4, ':');	%     % Assigns to b the elements in A at indices:  1st dimension=1, %       2nd dimension=3:4 and 3rd dimension=all elements. %%  Start        : 960930 Svante Bj鰎klund (svabj).%  Latest change: $Date: 2000/10/13 19:53:32 $ $Author: svabj $.%  $Revision: 1.1 $% *****************************************************************************maxNoIndex = 6;if (nargin < 7)  ix6 = 1;endif (nargin < 6)  ix5 = 1;endif (nargin < 5)  ix4 = 1;endif (nargin < 4)  ix3 = 1;endif (nargin < 3)  ix2 = 1;endif (nargin < 2)  ix1 = 1;endsizeMM = getr(multiMatrix,'size');MM     = getr(multiMatrix, 'matrix');sizeMM = [sizeMM ones(1,maxNoIndex-size(sizeMM,2))];if (isstr(ix1) & (ix1 == ':'))  ix1 = 1:sizeMM(1,1);endif (isstr(ix2) & (ix2 == ':'))  ix2 = 1:sizeMM(1,2);endif (isstr(ix3) & (ix3 == ':'))  ix3 = 1:sizeMM(1,3);endif (isstr(ix4) & (ix4 == ':'))  ix4 = 1:sizeMM(1,4);endif (isstr(ix5) & (ix5 == ':'))  ix5 = 1:sizeMM(1,5);endif (isstr(ix6) & (ix6 == ':'))  ix6 = 1:sizeMM(1,6);endminIndex = [min(ix1),min(ix2),min(ix3),min(ix4),min(ix5),min(ix6)];if (any(minIndex < 1))  error('Some index is to low.')end% check so that no index is larger than the corresponing element in 'sizeMM'.maxIndex = [max(ix1),max(ix2),max(ix3),max(ix4),max(ix5),max(ix6)];if (any(maxIndex > sizeMM))  error('Some index is to high.')end[noIndex1, noIndex2] = matvar('getnoix',sizeMM, ix1, ix2, ix3, ix4, ix5, ix6);index = matvar('expandix',sizeMM, ix1, ix2, ix3, ix4, ix5, ix6);Matrix = reshape(MM(index,1), noIndex1, noIndex2);sizeMatrix = size(Matrix);if (((sizeMatrix(1) == 1) | (sizeMatrix(2) == 1)) & (length(ix2) > 1))  Matrix = Matrix.';end%if

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -