Error using chckxy: The first input must contain unique values, while using only unique values
Afficher commentaires plus anciens
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 commentaires
dpb
le 18 Juin 2021
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
le 18 Juin 2021
Réponse acceptée
Plus de réponses (1)
Hélio Filho
le 18 Juin 2021
0 votes
Catégories
En savoir plus sur Spline Postprocessing dans Centre d'aide et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
