How to extract data from cdfplot()
Show older comments
Hello, allow me inqure something that might be simple but is proving to be a challenge to me. I have this code attached. I would like to extract data from the cdfplot() but I keeop getting errors (error attached below) even after reoving the inf at the end. What can be the problem and how can I avoid it?
A =10*rand(100000,1);
figure()
cdfplot(A)
H = get(gca, 'Children');
x = get(H, 'XData');
y = get(H, 'YData');
xr = 1.24
yr = interp1(x, y, xr)
Error using griddedInterpolant
The coordinates of the input points must be finite values; Inf and NaN are not permitted.
Error in interp1 (line 151)
F = griddedInterpolant(X,V,method);
Error in Epr7errorfunc (line 10)
yr = interp1(x, y, xr)
Accepted Answer
More Answers (1)
Shreeya
on 8 Oct 2024
0 votes
Hello
The error suggests that either zeros/NaN values are being generated in the code due to an arithmetic operation. Applying appropriate conditions to avoid such data points should help mitigate the issue.
Refer to the below MATLAB Answer to understand all the possible reasons resulting in NaN values to help avoid them:
Categories
Find more on Spline Postprocessing 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!