trajs2cell.m

来自「轨迹聚类工具箱及其相关说明和文章(台风路径分类等)。如有问题可与wyljess@」· M 代码 · 共 52 行

M
52
字号
function [y,x] = trajs2cell(trajs)
%Trajs2Cell  Extract curves in 'Trajs' format into Cell format
%
%   [y,x] = Trajs2Cell(trajs)

% Scott J Gaffney   20 October 2003
% Department of Information and Computer Science
% University of California, Irvine.
%
% Changes
% -----------------------------------


PROGNAME = 'Trajs2Cell';
if (~nargin)
  try; help(PROGNAME); catch; end
  return;
end

y=[];  x=[];

% trajs is already in Cell format
if (iscell(trajs))
  y = trajs;
  return;
end

% Feature Vector format
if (~isstruct(trajs) & isnumeric(trajs))
  y = fvec2cell(trajs);
  return;
end

% Handle 'Trajs' structure
if (isfield(trajs,'Y'))
  trajs = SetFieldDef(trajs,'X',[]);
  if (iscell(trajs.Y))
    y = trajs.Y; 
    x = trajs.X;
  end
  if (~isfield(trajs,'Seq') | isempty(trajs.Seq))
    y = fvec2cell(trajs.Y);
  else
    [y,x] = seq2cell(trajs.Y,trajs.Seq,trajs.X);
  end
  return;
end

% Cycs format
if (isfield(trajs,'trajs'))
  y = trajs.trajs;
end

⌨️ 快捷键说明

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