flatten_.m

来自「基于OFDM的无线宽带系统仿真It contains mainly two pa」· M 代码 · 共 25 行

M
25
字号
function res = flatten_(m, dim)  % DESCRIPTION res = flatten_(m, dim)%  Align all elements of m along dimension dim.%  The elements are taken columnwise from m.%  If dim is not present along rows is assumed.%  m can be any matrix and dim can be any %  scalar integer from 1 and up.% INPUT %  m --    any matrix %  dim --  any integer greater than 0% OUTPUT%  res --  A matrix only spanning dimesion dim.% TRY%  flatten_([1 2; 3 4],3) % by Magnus Almgren 970527if nargin > 1   % Note the extra 1 at the end, since reshape needs   % a dimension vector of at least 2 element.  res = reshape(m,[ones(1, dim-1), prod(size(m)) 1]);else  res = m(:); % in the old matlab4 styleend

⌨️ 快捷键说明

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