Error using cppelt - findchangepts function
9 views (last 30 days)
Show older comments
Hello everyone,
I need to get the breakpoints of a time series. I coded
bp = findchangepts(data,'MaxNumChanges',2);
However I obtained
Error using cppelt
The input data type must be either single or double precision
Error in findchangepts>cpmulti (line 241)
[cpmax, minresidue] = cppelt(x, 0, Lmin, statistic);
Error in findchangepts (line 76)
[cp, residue] = cpmulti(x, statistic, Lmin, Kmax);
Apparently, the problem is 'MaxNumChanges',2, because if I skip it, I get a result (only 1 breakpoint). My data type is double precision, so I don't understand what happens
Somebody could help me, please?
Thanks a lot
0 Comments
Answers (1)
Star Strider
on 17 Apr 2022
Your findchangepts call works correctly when I test it here —
t = linspace(0, 10);
data = +(t>4.5); % The '+' Converts 'logical' To 'double'
bp = findchangepts(data,'MaxNumChanges',2)
figure
plot(t, data, t(bp), data(bp), 'pg', 'MarkerSize',11)
grid
ylim([-0.1 1.1])
whos t data
.
0 Comments
See Also
Categories
Find more on Multirate Signal Processing in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!