Replacing individual Values in Data column based on a condition

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];

 採用された回答

Stephen23
Stephen23 2019 年 5 月 9 日

0 投票

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

1 件のコメント

JessHmann
JessHmann 2019 年 5 月 13 日
編集済み: JessHmann 2019 年 5 月 13 日
Thank you! :)

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeCharacters and Strings についてさらに検索

製品

リリース

R2019a

タグ

質問済み:

2019 年 5 月 9 日

編集済み:

2019 年 5 月 13 日

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by