Conversion of Matrix dimensions

6 views (last 30 days)
Fayyaz
Fayyaz on 17 May 2015
Commented: Star Strider on 17 May 2015
Hi
I have a matrix 81 by 81 i.e.
1 2 . . 81
1 a1,1 a1,2 a1,81
.
.
81 a81,1 a81,81
I need to convert it to a matrix of order 6561 (81*81) by 2 i.e.
1=a1,1
2=a1,2
. .
81=a81,81
Any help in this regard would be greatly appreciated. Thanks in advance.
  4 Comments
Fayyaz
Fayyaz on 17 May 2015
Thanks all for your comments. Problem has been solved. :)

Sign in to comment.

Accepted Answer

Star Strider
Star Strider on 17 May 2015
Edited: Star Strider on 17 May 2015
If ‘A’ is your matrix, either use the reshape function:
Av = reshape(A, [], 1);
or simply use the vector default:
Av = A(:);
EDIT — I didn’t see the repeating indices in the first column. To create them, use the repmat function:
Ix = repmat(1:81, 1, 81)';
  2 Comments
Fayyaz
Fayyaz on 17 May 2015
Both of them are OK. thanks :)

Sign in to comment.

More Answers (0)

Categories

Find more on Resizing and Reshaping Matrices in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!