Remove all infinite values from ydata and then remove those same indices from the xdata so the vectors remain the same length
6 次查看(过去 30 天)
显示 更早的评论
Any recommendations to remove all infinite values from ydata and then remove those same indices from the xdata so the vectors remain the same length? I have removed the infinite values from the ydata and then outputed the indices that are finite, but I am unsure how to easily extract these same indices from the xdata. Thank you
0 个评论
回答(1 个)
James Tursa
2020-1-7
编辑:James Tursa
2020-1-7
x = isinf(ydata);
ydata(x) = [];
xdata(x) = [];
Or, if you need to extract the values into new variables,
x = ~isinf(ydata);
ydata_new = ydata(x);
xdata_new = xdata(x);
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Numeric Types 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!