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