Using if condition store values in an array

3 ビュー (過去 30 日間)
Waqas Siddique
Waqas Siddique 2021 年 2 月 19 日
編集済み: Walter Roberson 2021 年 2 月 20 日
I have a list of numbers stored as double type in a variable B. I want to use if condition so that if the value of element in B is greater than or equal to 12, I want to store all those values in another array named C.

採用された回答

the cyclist
the cyclist 2021 年 2 月 19 日
If I understand you correctly, this does what you want. (It doesn't directly use "if", but does the job via logical indexing instead.)
C = B(B>=12);

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeOperators and Elementary Operations についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by