How to extract the 1 to 4 row and skip 5&6 and continuse 7 and 8 row?

1 回表示 (過去 30 日間)
vimal kumar chawda
vimal kumar chawda 2021 年 7 月 2 日
回答済み: Nikhil Sapre 2021 年 7 月 2 日
I have 8*1 matrix.
I want to extract the first four element( 1st to 4th position) in new vector and last 2 element(7&8 position). How can I do it?
x1 =[6856.06600000000
65128.6516000000
6881.95430000000
65135.3738000000
6810.99550000000
65302.1415000000
6836.86630000000
65308.8605000000]
So my new vector will be
new =[6856.06600000000
65128.6516000000
6881.95430000000
65135.3738000000
6836.86630000000
65308.8605000000]

採用された回答

Nikhil Sapre
Nikhil Sapre 2021 年 7 月 2 日
This should work
new = [x1(1:4)]
new = [new; x1(end-1:end)]
Thanks,
Nikhil

その他の回答 (0 件)

カテゴリ

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

タグ

製品


リリース

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by