필터 지우기
필터 지우기

Replace array elemtens, that match the condition

조회 수: 2 (최근 30일)
Alexander Donner
Alexander Donner 2018년 1월 28일
댓글: Alexander Donner 2018년 2월 1일
Hey guys,
I have an array with x= 1:1:100; and i want to replace every element that is <= than 10 with 0.
My thought was to us the "if" function under an "for" loop, but i dont realy know how to do that.
i hope you guys can help me with that.
Thanks in advance.

채택된 답변

Srikanth Sedimbi
Srikanth Sedimbi 2018년 1월 31일
Try logical indexing
x(x<=10) = 0

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by