How to extract data from cdfplot()
显示 更早的评论
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)
采纳的回答
更多回答(1 个)
Shreeya
2024-10-8
0 个投票
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:
类别
在 帮助中心 和 File Exchange 中查找有关 Spline Postprocessing 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!