How to swap columns of a matrix??

84 ビュー (過去 30 日間)
Ali nouri
Ali nouri 2020 年 3 月 24 日
回答済み: Sayali 2023 年 6 月 6 日
I have a matrix of 8760X30, the first 7 columns need to be swap with some other column. eg. the first and the second columns need to need to be swap with the 8 and 9 column.

採用された回答

Birdman
Birdman 2020 年 3 月 24 日
Simple approach(Consider matrix A):
A(:,[1 2 8 9])=A(:,[8 9 1 2])

その他の回答 (1 件)

Sayali
Sayali 2023 年 6 月 6 日
a=[ 1 2 3; 2 4 5]

カテゴリ

Help Center および File ExchangeCreating and Concatenating Matrices についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by