Info

This question is closed. Reopen it to edit or answer.

swap matrix positions in 3d matrices

1 view (last 30 days)
Jam
Jam on 17 Jan 2013
Closed: MATLAB Answer Bot on 20 Aug 2021
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 Comment
Jan
Jan on 17 Jan 2013
Such questions are discussed exhaustively in the Getting Started chapters of the documentation. It is recommended to read them.

Answers (2)

Andrei Bobrov
Andrei Bobrov on 17 Jan 2013
Edited: Andrei Bobrov on 17 Jan 2013
a(1,1:2,:) = a(1,[2,1],:);

Colin
Colin on 17 Jan 2013
a(1,[1 2],:) = a(1,[2 1],:);

Tags

Products

Community Treasure Hunt

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

Start Hunting!