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

📄 mymat2cell.m

📁 Continuous Profile Models (CPM) Matlab Toolbox.
💻 M
字号:
function c = mymat2cell(m,rowSizes,colSizes)%MYMAT2CELL.M Break matrix up into a cell array of matrices.%%	Synopsis%%	  mymat2cell.m(M,R,C);%%	Description%%	  MYMAT2CELL.M(M,R,C) takes three arguments,%	    M - ROWxCOL Matrix.%	    R - Vector of row sizes (should sum to ROW).%	    C - Vector of col sizes (should sum to COL).%	  and returns a cell array of matrices, found using R and C.%%	Example%%	   M = [1 2 3 4; 5 6 7 8; 9 10 11 12];%	   C = mymat2cell.m(M,[1 2],[2 2])%	    %	See also CELL2MATswitch nargin  case 1,    c = {m};    case 2,    rows = length(rowSizes);    c = cell(rows,1);    rowStart = 0;    for i=1:rows      c{i,1} = m(rowStart+[1:rowSizes(i)],:);      rowStart = rowStart + rowSizes(i);    end	  case 3,    rows = length(rowSizes);	cols = length(colSizes);    c = cell(rows,cols);    rowStart = 0;    for i=1:rows	  colStart = 0;	  for j=1:cols        c{i,j} = m(rowStart+[1:rowSizes(i)],colStart+[1:colSizes(j)]);        colStart = colStart + colSizes(j);	  end      rowStart = rowStart + rowSizes(i);    endend

⌨️ 快捷键说明

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