I think standardizeMissing is the way to go here. It's "straight-forward" to do it explicitly
>> t = table(["a";"b";"c"],[1;999;3],[999;5;999])
t =
3×3 table
Var1 Var2 Var3
____ ____ ____
"a" 1 999
"b" 999 5
"c" 3 999
>> idx = t{:,2:3} == 999
idx =
3×2 logical array
0 1
1 0
0 1
>> t{:,2:3}(idx) = NaN
t =
3×3 table
Var1 Var2 Var3
____ ____ ____
"a" 1 NaN
"b" NaN 5
"c" 3 NaN
but it takes a little thought to get your head around all of what's going on there. Which is why standardizeMissing exists.
>> t = table(["a";"b";"c"],[1;999;3],[999;5;999]);
>> standardizeMissing(t,999)
ans =
3×3 table
Var1 Var2 Var3
____ ____ ____
"a" 1 NaN
"b" NaN 5
"c" 3 NaN
Best Answer