필터 지우기
필터 지우기

facing a PointLocation error while using ginput !

조회 수: 1 (최근 30일)
Ano
Ano 2016년 10월 26일
댓글: Walter Roberson 2017년 7월 26일
Hello! HELP PLEASE! I am using the PointLocation in my script but I keep getting this error 'Undefined function 'PointLocation' for input arguments of type double', knowing that the input is a point coordinates (x,y) obtained using 'ginput' function and a delaunay triangulation (DT) such that: T= PointLocation ( DT, x,y)
  댓글 수: 5
Ano
Ano 2016년 10월 27일
Yes, in my code it is with lower p but even though I still get the error !!
Walter Roberson
Walter Roberson 2016년 10월 27일
Please show how you construct DT and call pointLocation

댓글을 달려면 로그인하십시오.

채택된 답변

Walter Roberson
Walter Roberson 2016년 10월 27일
편집: Walter Roberson 2017년 7월 25일
  댓글 수: 10
ABDUL REHMAN
ABDUL REHMAN 2017년 7월 26일
편집: Walter Roberson 2017년 7월 26일
Thnaks again for your help, I m posting here my code, still getting error.
h=0.01;
L=0.10;
W=0.05;
Nx=17;
Ny=9;
Number=3;
epsilon=1e-6;
M=1;
for i=1:Nx+1
for j=1:Ny+1
X(M)=-L/2+(i-1)/Nx*L;
Y(M)=-W/2+(j-1)/Ny*W-epsilon*X(M);
M=M+1;
end
end
TRI = delaunayTriangulation([X',Y']);
t=TRI';
t(4,:)=0;
p=[X; Y; -h*ones(1,length(X))];
save plate p t
PatchNumber=[];
viewer plate; view(0,90); hold on
m=0;
while ~isempty(t)
m=m+1;
[xi,yi]=ginput;
TriangleNumber = pointLocation(TRI,xi,yi);
n=t(1:3,TriangleNumber);
PatchNumber= [PatchNumber TriangleNumber];
x= p(1,n);
y= p(2,n);
if isempty(xi|yi) break; end
fill(x,y,Color4)
clear xi yi
end
t(4,:)=3;
t(4,PatchNumber)=2;
save plate p t
with the delaunayTriangulation, the error is what I mentioned above.
"Error using delaunayTriangulation/subsasgn
Invalid arguments in indexing operation."
Error in...
"t(4,:)=0;"
When I use just delaunay it runs but gives error at pointLocation when I pick the points using ginput, with the input type double.
Walter Roberson
Walter Roberson 2017년 7월 26일
It is meaningless to set the 4th column of a triangulation object.

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Ano
Ano 2016년 10월 28일
the DT was constructed as it follow:
N=20; %Discretization parameter
L=50; % Length
for i=1:N+1 %descritisation
for j=1:N+1
X(i)=-L/2+(i-1)/N*L;
Y(j)=-L/2+(j-1)/N*L;
end
end
DT = delaunay(X,Y);
DTt=DT';
while ~isempty(DTt)
[x,y]=ginput(1);
T = pointLocation ( DT, x ,y);
end

카테고리

Help CenterFile Exchange에서 Delaunay Triangulation에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by