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

📄 setm.m

📁 matlab阵列信号处理工具箱
💻 M
字号:
function Mout = setm(multiMatrix, M2d, 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 Mout = setm(Min, 2Dmatrix, ix1, ix2, ix3, ix4, ix5, ix6)%%  Assigns a two-dimensional matrix to a part of a multidimensional matrix %  (multimatrix). The first specified index/subscript (ix1, ix2, ix3, ix4,%  ix5 or ix6) for the multidimensional matrix that is%  a vector will corresponds to different rows in the two-dimensional matrix.%  If the two-dimensional matrix in fact is a vector, the index in the %  vector corresponds the index in the multidimensional matrix that is a vector.%%  Mout         MultimatrixT%  multiMatrix  MultimatrixT%  M2d          A normal 2D Matlab matrix.%  ix1, ix2, ix3, ix4, ix5, ix6: Index (integer row vectors or ':').%%  Ex:%     A = setm(A, [1 2; 3 4], 1, 3:4, 5:6);	%     % Assigns the [1 2; 3 4] to the elements A(1, 3:4, 5:6).%%  The indexnumber ':' can be used to denote all elements in a dimension.%%  Start        : 960930 Svante Bj鰎klund (svabj).%  Latest change: $Date: 2000/10/13 19:53:44 $ $Author: svabj $.%  $Revision: 1.1 $% *****************************************************************************% 'MM' is a column vector.%  the first index is the "fastest loop".%  in 'MM':%    1st index is row index.%    2nd index is column index.%    3rd index is matrix index.%    4th, 5th, 6th index.% 'sizeMM' is a row vector.maxNoIndex = 6;if (nargin < 8)  ix6 = 1;endif (nargin < 7)  ix5 = 1;endif (nargin < 6)  ix4 = 1;endif (nargin < 5)  ix3 = 1;endif (nargin < 4)  ix2 = 1;endif (nargin < 3)  ix1 = 1;endif (multiMatrix == [])  multiMatrix = zerosm([max(ix1) max(ix2) max(ix3)]);end%ifsizeMM = 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'. Or change '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] = getnoix(ix1, ix2, ix3, ix4, ix5, ix6);index = matvar('expandix',sizeMM, ix1, ix2, ix3, ix4, ix5, ix6);MM(index(:),1) = M2d(:);Mout = setr(multiMatrix, 'matrix', MM);% check so that no index is larger than the corresponing element in 'sizeMM'. Or change 'sizeMM'if(0)  sizeMM = max([indexMatrix; sizeMM]);  Mout = setr(Mout, 'matrix', MM);end

⌨️ 快捷键说明

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