How to split a vector based on using another value?

Hi,
I wish to split a vector into two separate vectors based on whether they are higher than a pre-defined value.
For example, A=[10,9,8,7,6,5,4,3,2,1] and a=4. Then I want to split 'A' into one vector where all the values are higher than 'a' and another vector with the remaining values.
So that I can get B=[10,9,8,7,6,5] and C=[4,3,2,1].
Any help would be greatly appreciated.

 採用された回答

Azzi Abdelmalek
Azzi Abdelmalek 2013 年 11 月 9 日
編集済み: Azzi Abdelmalek 2013 年 11 月 9 日

2 投票

A=[10,9,8,7,6,5,4,3,2,1] ;
B=A(A>4)
C=A(A<=4)

1 件のコメント

Naweed
Naweed 2013 年 11 月 9 日
Thanks for the quick answer, I was using a slightly more complicated approach.

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

その他の回答 (0 件)

カテゴリ

タグ

質問済み:

2013 年 11 月 9 日

コメント済み:

2013 年 11 月 9 日

Community Treasure Hunt

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

Start Hunting!

Translated by