swap matrix positions in 3d matrices

How do I swap matrix positions? So if I wanted
a(1,1,:) = [1 2 3 4];
a(1,2,:) = [1 1 1 1];
to become
a(1,1,:) = [1 1 1 1];
a(1,2,:) = [1 2 3 4];

댓글 수: 1

Jan
Jan 2013년 1월 17일
Such questions are discussed exhaustively in the Getting Started chapters of the documentation. It is recommended to read them.

답변 (2개)

Andrei Bobrov
Andrei Bobrov 2013년 1월 17일
편집: Andrei Bobrov 2013년 1월 17일

1 개 추천

a(1,1:2,:) = a(1,[2,1],:);
Colin
Colin 2013년 1월 17일

0 개 추천

a(1,[1 2],:) = a(1,[2 1],:);

이 질문은 마감되었습니다.

제품

태그

질문:

Jam
2013년 1월 17일

마감:

2021년 8월 20일

Community Treasure Hunt

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

Start Hunting!

Translated by