MATLAB Answers

0

Replacing individual Values in Data column based on a condition

Asked by JessHmann on 9 May 2019
Latest activity Edited by JessHmann on 13 May 2019
Hello!
I am new to matlab and programming in generall. I have been working with a large data table. I have a few outliers in one o the columns and would like to replace them with the value 1.
However, I keep getting the error "Right hand side of an assignment into a table must be another table or a cell array."
Here is my code. Any help is appreciated!
myData=db_data.dataTable;
myData(myData.fluid_p_rel<0.9,:)=[1];
myData(myData.fluid_p_rel>1.2,:)=[1];

  0 Comments

Sign in to comment.

Products


Release

R2019a

1 Answer

Answer by Stephen Cobeldick on 9 May 2019
 Accepted Answer

idx = myData.fluid_p_rel<0.9 | myData.fluid_p_rel>1.2;
myData.fluid_p_rel(idx) = 1

  1 Comment

Sign in to comment.