horzcat.m

来自「一个matlab的将军模型」· M 代码 · 共 52 行

M
52
字号
function v = horzcat(v1,v2)

% Concatenate two vertices objects 
%
% Syntax:
%   "vtcs = horzcat(v1,v2)"
%
%   "vtcs = [v1 v2]"
%
% Description:
%   "horzcat(v1,v2)" returns a vertices object containing the points from
%   "v1" with the points from "v2" appended.  "v2" can be passed as a
%   list of points, which will first be converted to a vertices object then
%   added to "v1".
%
% Examples:
%   Given a vertices object, "v1" representing a square in the x3 = 0
%   plane with corners at (x1,x2) pairs (2,1), (2,3), (4,3), and (4,1), 
%
%
%
%   "v2 = [
%
%   "2 2 4 4"
%
%   "1 3 3 1"
%
%   "2 2 2 2];"
%
%   "vtcs = horzcat(v1,v2)"
%
%
%
%   results in "vcts" a vertices object representing a cube with corners
%   at (x1,x2,x3) triples (2,1,0), (2,3,0), (4,3,0), (4,1,0), (2,1,2),
%   (2,3,2), (4,3,2), and (4,1,2).
%
% See Also:
%   vertices

if ~isa(v2,'vertices')
  v2 = vertices(v2);
end

if (length(v1) > 0) & (length(v2) > 0) & (dim(v1) ~= dim(v2))
  disp('VERTICES/OR: different dimensions given')
  return
end

v = vertices;
v.list = [v1.list v2.list];

⌨️ 快捷键说明

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