How do I replace elements of matrix which are greater than 9 with value 9 without using for loop?

1 次查看(过去 30 天)
I am working on an optimization problem. To make it run faster I need to do calculation inside defined function using matrices and not using foor loops. In that context I have this problem where a row matrix elements need to replaced by 9 if it is greater than 9. Can this be done using some matrix notation or I have to use for loop.
Thanks

采纳的回答

Walter Roberson
Walter Roberson 2021-10-1
min(9,TheMatrix)

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Multidimensional Arrays 的更多信息

产品


版本

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by