Replace all numbers in a cell array that are less than 10 to 10.

1 次查看(过去 30 天)
I have a cell array that holds mutiple different sized cell arrays inside it. The values are all numbers. I want to replace all numbers that are less than 10 to 10.
Thanks in advance!

采纳的回答

Walter Roberson
Walter Roberson 2019-4-24
cellfun(@(C) cellfun(@(M) max(M,10), C, 'uniform', 0), YourOuterCellArray, 'uniform', 0)
  4 个评论
Walter Roberson
Walter Roberson 2019-4-24
编辑:Walter Roberson 2019-4-24
You had posted that you have a cell array that holds different sizes of cell arrays in it. However, that is not accurate: it holds different sizes of numeric arrays in it.
cellfun(@(THIS_IS_A_DUMMY_VARIABLE_THAT_STANDS_IN_FOR_A_PARTICULAR_ARRAY) max(THIS_IS_A_DUMMY_VARIABLE_THAT_STANDS_IN_FOR_A_PARTICULAR_ARRAY,10), h1c, 'uniform', 0)
Austin Sowers
Austin Sowers 2019-4-24
Thank you so much! Sorry for the confusion. Still very new with MATLAB. Works great.

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Matrix Indexing 的更多信息

产品


版本

R2016b

Community Treasure Hunt

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

Start Hunting!

Translated by