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 Center および File ExchangeSimulink Functions についてさらに検索

製品


リリース

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by