How to replace numbers in an array

조회 수: 54 (최근 30일)
zhe li
zhe li 2011년 11월 8일
댓글: maede parishani 2023년 2월 15일
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일
  댓글 수: 2
zhe li
zhe li 2011년 11월 8일
Thank you very much, Andrei.
maede parishani
maede parishani 2023년 2월 15일
Thank you!

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Data Type Identification에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by