How to swap columns of a matrix??

78 visualizzazioni (ultimi 30 giorni)
Ali nouri
Ali nouri il 24 Mar 2020
Risposto: Sayali il 6 Giu 2023
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.

Risposta accettata

Birdman
Birdman il 24 Mar 2020
Simple approach(Consider matrix A):
A(:,[1 2 8 9])=A(:,[8 9 1 2])

Più risposte (1)

Sayali
Sayali il 6 Giu 2023
a=[ 1 2 3; 2 4 5]

Categorie

Scopri di più su Creating and Concatenating Matrices in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by