joinvars.m

来自「intlab 工具用于快速计算 各各层的倒数等等」· M 代码 · 共 27 行

M
27
字号
function [z,I,J] = joinvars(x,y)
%JOINVARS     joins sets of variables x and y into one set z
%
%   [z,I,J] = joinvars(x,y)
%
%On entry, string or string cell array x is a set of mutually disjoint variables,
%  and string or string cell array y is a set of mutually disjoint variables.
%On return, variables x and y are merged into z such that
%  z(I) corresponds to the set x, and z(J) corresponds to the set y.
%

% written  08/28/00     S.M. Rump
%

  % make sure, variables are stored in cell arrays (covers univariate case)
  if ~iscell(x)
    x = {x};
  end
  if ~iscell(y)
    y = {y};
  end
  
  nx = length(x);
  [z,dummy,IJ] = unique([x y]);
  I = IJ(1:nx);
  J = IJ(nx+1:end);

⌨️ 快捷键说明

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