myunique.m

来自「实现地震勘探中」· M 代码 · 共 28 行

M
28
字号
function [out,index]=myunique(in)% Remove duplicates from "in" in such a way that the last one is retained% % Written by: E. R.: December 2, 2006% Last updated:%%        out=myunique(in)% INPUT% in     cell vector of strings% OUTPUT% out    input cell vector with leading duplicates removed% index  index such that out=in(index)%% EXAMPLE%       a=[2 3 4 3 1 3 6];%       [b,index]=myunique(a)global S4Mif S4M.matlab_version > 7.2   [dummy,index]=unique(in,'last'); %#ok  First output argument is not requiredelse   [dummy,index]=unique(in);        %#ok  First output argument is not requiredendindex=sort(index);out=in(index);

⌨️ 快捷键说明

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