Splitting a vector into two independent vectors based on values of the elements

1 回表示 (過去 30 日間)
Zhimeng Wang
Zhimeng Wang 2020 年 6 月 16 日
編集済み: madhan ravi 2020 年 6 月 16 日
I've got an array, say
a = [1,3,5,8,6,1,8,8,0,1,7,5];
How can I split this array into two arrays, and in one new array, all the elements(both inclusive) and all the other elements go into the other array?
That is to say, I want to get two arrays:
a1 = [1,1,0,1];
a2 = [3,5,8,6,8,8,7,5];
Thank you in advance!

回答 (1 件)

madhan ravi
madhan ravi 2020 年 6 月 16 日
編集済み: madhan ravi 2020 年 6 月 16 日

カテゴリ

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