Error using chckxy: The first input must contain unique values, while using only unique values
Mostra commenti meno recenti
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 Commenti
dpb
il 18 Giu 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
il 18 Giu 2021
Risposta accettata
Più risposte (1)
Hélio Filho
il 18 Giu 2021
0 voti
Categorie
Scopri di più su Spline Postprocessing in Centro assistenza e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
