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

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

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

제품

릴리스

R2018b

질문:

2021년 10월 1일

댓글:

2021년 10월 1일

Community Treasure Hunt

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

Start Hunting!

Translated by