MATLAB Answers

Remove all infinite values from ydata and then remove those same indices from the xdata so the vectors remain the same length

2 views (last 30 days)
mht6
mht6 on 6 Jan 2020
Edited: James Tursa on 7 Jan 2020
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 Comments

Sign in to comment.

Answers (1)

James Tursa
James Tursa on 7 Jan 2020
Edited: James Tursa on 7 Jan 2020
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 Comments

Sign in to comment.

Sign in to answer this question.