Error using chckxy: The first input must contain unique values, while using only unique values
이전 댓글 표시
Hello,
So I have to spline some data I acquired with ginput. While using spline, I get the following error
Error using chckxy
The first input must contain unique values.
At first I thought I had accidently selected two or more equal points, so I tried selecting random points which I knew were different for sure, and I still get the same error.
Then, I get another error in spline itself:
[x,y,sizey,endslopes] = chckxy(x,y);
Keep in mind this is not even part of my code, this is just matlab's function.
The code I use to acquire the points is this one:
mov = VideoReader('pendulo.mp4'); % estrutura com video
nFrames = mov.NumFrames; % numero de frames
framerate = mov.FrameRate; % numero de frames por segundo
dtframes=1/framerate; %tempo entre frames
i=1; t=0; tf=nFrames*dtframes; dt=10*dtframes;
if ~exist('dados.mat','file')
while (t <= tf)
mov.CurrentTime=t; frame=readFrame(mov); image(frame); drawnow
tv(i)=t; t=t+dt; i=i+1; title(strcat('Frame ',num2str(i)));
[x(i) ,y(i)]=ginput(1);
end
save ('dados.mat', 'x', 'y');
load ('dados.mat', 'x', 'y');
end
and the code I use for the spline function is this one:
load ('dados.mat', 'x', 'y');
xx = linspace(0,500,100);
yy = spline(x,y,xx);
figure;
plot(x, y, 'ro');
hold on;
plot(xx, yy, 'b', 'LineWidth', 1.5);
I don't understand why I get an error at MATLAB's own function, and why I get the "must contain unique values" error, even though they are unique.
The data is annexed as 'dados.mat'.
댓글 수: 2
dpb
2021년 6월 18일
Post a complete working example here that illustrates the problem, not on some external site.
Need the data mostly, of course; nothing we can do without it to diagnose anything...
Hélio Filho
2021년 6월 18일
채택된 답변
추가 답변 (1개)
카테고리
도움말 센터 및 File Exchange에서 Spline Postprocessing에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
