selecting elements from an array

2 ビュー (過去 30 日間)
Nikolas Spiliopoulos
Nikolas Spiliopoulos 2017 年 2 月 20 日
hi all,
I have an array 3x258, is there any way to create two different arrays where the first one will contain the columns that their last element is negative, and the other one the rest of them? thanks!

採用された回答

Adam
Adam 2017 年 2 月 20 日
idx = myArray( end, : ) < 0;
negLastElementCols = myArray( :, idx );
theRest = myArray( :, ~idx );
  1 件のコメント
Nikolas Spiliopoulos
Nikolas Spiliopoulos 2017 年 2 月 20 日
thanks a lot!

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMatrices and Arrays についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by