Could anybody help me solve the problem please? I have a sample array a=[3 2 5 7 4 8 2 5], I would like to replace all numbers greater than 5(>5) to be 5, the expected result should be a=[3 2 5 5 4 5 2 5]. Thank you very much.

 채택된 답변

Andrei Bobrov
Andrei Bobrov 2011년 11월 8일

20 개 추천

a(a>=5)=5

댓글 수: 2

zhe li
zhe li 2011년 11월 8일
Thank you very much, Andrei.
maede parishani
maede parishani 2023년 2월 15일
Thank you!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

태그

질문:

2011년 11월 8일

댓글:

2023년 2월 15일

Community Treasure Hunt

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

Start Hunting!

Translated by