增加了计算一维元素坐标的功能,计算时需将row设为1,col就是元素的个数,ini为首末元素的位置,按行排列。 删去了一些用不到的代码。 同时将坐标输出为txt文档
function location = position(ini,row,col)
% ------------------------------------
% This program is used to calculate the position of
% every matrix element in a 3D or 2D plane or line
%
% A col B
% * * * *
% row * * * *
% * * * *
% * * * *
% C D
%
% Input:
% ini: the initial 3 points of the plane, A B C, row vectors.
% for example:[0,0,0; 0,4,4; 4,0,0];
% col: the column of the matrix, say, col=5;
% row: the row of the matrix, say, row=5;
%
% Special Case: if ini is a 2*3 or 2*2 matrix, that means all the elec are in a
% line. for this case, row = 1;
%
% Output:
% pos: 3D vectors. Each slice contains the positions of the row points.
% location: 2D vectors, s