MATLAB Answers

Set lower than 0.1 values to zero in tables that stored in a cell

2 views (last 30 days)
Dear all,
In a 1x3 cell containing three (28x6) tables; inside tables how I can set each value that lower than 0.1 to zero in a1 and a2 columns (names of columns are a1 and a2) of all tables?
Thank you all


Sign in to comment.

Accepted Answer

Fangjun Jiang
Fangjun Jiang on 28 May 2020
In general, this is how you do it. Apply it to a table inside a cell should not be that difficult.


Behzad Navidi
Behzad Navidi on 28 May 2020
Thank you so much, Is it something like this? (If C is my cell)
index = cellfun(@(x) x<0.1, C, 'UniformOutput', 1);
altough this leads me to an error:
Operator '<' is not supported for operands of type 'table'.
Error in @(x)x<0.1
But I think it sould be like this?
I need to keep my cell as it is (1x3 cell with tables).
Thank you anyway
Fangjun Jiang
Fangjun Jiang on 28 May 2020
If the data inside the cell is array (not table object), then you can do this
cellfun(@(x) x(x<0.1)=0, C, 'UniformOutput', false);

Sign in to comment.

More Answers (0)




Translated by