Borrar filtros
Borrar filtros

How to swap columns of a matrix??

50 visualizaciones (últimos 30 días)
Ali nouri
Ali nouri el 24 de Mzo. de 2020
Respondida: Sayali el 6 de Jun. de 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.

Respuesta aceptada

Birdman
Birdman el 24 de Mzo. de 2020
Simple approach(Consider matrix A):
A(:,[1 2 8 9])=A(:,[8 9 1 2])

Más respuestas (1)

Sayali
Sayali el 6 de Jun. de 2023
a=[ 1 2 3; 2 4 5]

Categorías

Más información sobre Creating and Concatenating Matrices en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by