필터 지우기
필터 지우기

How to swap columns of a matrix??

조회 수: 50 (최근 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 CenterFile Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by