フィルターのクリア

Choosing elements from a 2D array

2 ビュー (過去 30 日間)
Lama Hamadeh
Lama Hamadeh 2021 年 12 月 9 日
コメント済み: Voss 2021 年 12 月 10 日
Hi all,
I have a 2D array int that has fixed avues of 1 on its second column but different values on its first column. How can I select the values from its first column to be within a range of .
int = [1.8702 1.0000 ; -0.8739 1.0000 ; 3.1069 1.0000 ; 0.9228 1.0000 ;-1.1946 1.0000 ; -0.1244 1.0000 ;...
0.2662 1.0000 ;0.3586 1.0000 ;0.2288 1.0000 ;0.0003 1.0000 ;-0.2503 1.0000];
Any help would be appreicted.
Thanks.

採用された回答

Voss
Voss 2021 年 12 月 9 日
int(int(:,1) >= 0 & int(:,1) <= 1,1)
  3 件のコメント
Lama Hamadeh
Lama Hamadeh 2021 年 12 月 9 日
I know how:
int = [int(int(:,1) >= 0 & int(:,1) <= 1, 1) ...
int(int(:,1) >= 0 & int(:,1) <= 1, 2)];
Thank you.
Voss
Voss 2021 年 12 月 10 日
That will work. A slightly simpler way is:
int = int(int(:,1) >= 0 & int(:,1) <= 1,:);
(I wasn't sure before if you wanted all the columns or just the first one.)

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMatrix Indexing についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by