Given a matrix, swap the 2nd & 3rd columns - MATLAB Cody - MATLAB Central

Problem 1321. Given a matrix, swap the 2nd & 3rd columns

Difficulty:Rate
If
a = [1 2 3 4;
1 2 3 4;
1 2 3 4;
1 2 3 4];
then the result is
ans = [1 3 2 4
1 3 2 4
1 3 2 4
1 3 2 4];
by swapping columns 2 and 3.

Solution Stats

52.13% Correct | 47.87% Incorrect
Last Solution submitted on Mar 24, 2025

Problem Comments

Solution Comments

Show comments
Who Deserves Your Praise? Discover the New Contribution Widget!
...
We are excited to announce another update to our Discussions area: the...

Problem Recent Solvers1140

Problem Tags

Community Treasure Hunt

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

Start Hunting!
Go to top of page