if variable i = zero then change row j of the same row to 0 - table

1 回表示 (過去 30 日間)
Mathieu St-AMour
Mathieu St-AMour 2021 年 5 月 21 日
編集済み: David Fletcher 2021 年 5 月 21 日
So I have a 5007717 x 16 Table and I changed all negative value of column 16 to zero. But now if column 16 is zero I want to change columne 3 of the same row to zero.
SO I tried things like
for i = 1:5007717
if pvdaqdata10(i,16) == 0
pvdaqdata10(i,3) = 0 ;
end
end
but it does'nt seem to work with table
Error: Incorrect use of '=' operator. To assign a value to a variable, use '='. To compare values for equality, use '=='.
Operator '==' is not supported for operands of type 'table'.
So my question is, how in a table do you change the value of a cell with respect to the value of a other cell of the same row and do that for each row ?
Thanks for your help
Regards

採用された回答

David Fletcher
David Fletcher 2021 年 5 月 21 日
編集済み: David Fletcher 2021 年 5 月 21 日
col16zero=(pvdaqdata10{:,16}==0)
pvdaqdata10{col16zero,3}=0

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLogical についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by