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 个评论

Such questions are discussed exhaustively in the Getting Started chapters of the documentation. It is recommended to read them.

回答(2 个)

Colin
Colin 2013-1-17
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