How to delete values less than a given limit?

조회 수: 59 (최근 30일)
Danny Maefengea
Danny Maefengea 2020년 6월 10일
답변: KSSV 2020년 6월 10일
Here's the question set up.
Create a 1 x 10 vector K with random values ranged 0-5.
Find a way to delete all the elements in K that are less than 2.5.

채택된 답변

KSSV
KSSV 2020년 6월 10일
If K is your 1*10 vector.
V(V<2.5) = [] ; % this removes all elements less then 2.5
V(V<2.5) = NaN ; % This will replace all elements less then 2.5 with NaNs

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Simulink Functions에 대해 자세히 알아보기

제품


릴리스

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by