📄 setm.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.%% Assigns a two-dimensional matrix to a part of a multidimensional matrix.% Matlab 5 compatibility version.% See "help setm" in main RECVAR directory for more information.% Start : 970820 Svante Bj鰎klund (svabj).% Latest change: $Date: 1998/07/12 18:44:08 $ $Author: svabj $.% $Revision: 1.5 $% *****************************************************************************% '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;end%if (multiMatrix == [])% multiMatrix = zerosm([max(ix1) max(ix2) max(ix3)]);%end%if%sizeMM = getr(multiMatrix,'size');%MM = getr(multiMatrix, 'matrix');sizeMM = size(multiMatrix);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);endif(0)minIndex = [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.')endend%if(0)%index = matvar('expandix',sizeMM, ix1, ix2, ix3, ix4, ix5, ix6);%MM(index(:),1) = M2d(:);%Mout = setr(multiMatrix, 'matrix', MM);Mout = multiMatrix;Mout(ix1, ix2, ix3, ix4, ix5, ix6) = M2d;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -