unsort_d.m

来自「计量工具箱」· M 代码 · 共 30 行

M
30
字号
% PURPOSE: demo of unsort() %          returns sorted vectors or matrices%          in unsorted (orginal) form % %---------------------------------------------------% USAGE: unsort_d%---------------------------------------------------n = 10; k = 4;tt = randn(n,1);       % generate a vector of random numbers[tts tti] = sort(tt);  % sort themttu = unsort(tts,tti); % unsort themfprintf(1,'These two vectors should be the same \n');[tt ttu]tt = randn(n,k);            % generate a matrix[junk tti] = sort(tt(:,1)); % sort by first columntts = tt(tti,:);ttu = unsort(tts,tti); % unsort themfprintf(1,'These two matrices should be the same \n');in.fmt = strvcat('%8.2f');mprint(tt,in);mprint(tt,in);

⌨️ 快捷键说明

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