How to make specific elements of a cell equal to zero?
10 次查看(过去 30 天)
显示 更早的评论
I have a cell 41 * 41 dimension and I would like to make the values that over 0.5 zeros and the rest of the values keep them without any changes.
Any assistance, please?
0 个评论
采纳的回答
更多回答(1 个)
Walter Roberson
2022-9-15
newCell = cellfun(@(M) M.*(M<=0.5), YourCell, 'uniform', 0)
However this will fail in locations that contain infinite values.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Numeric Types 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!