How to take a rectangular matrix of numbers and turn it into a matrix of the form (row, column, number)?

17 vues (au cours des 30 derniers jours)
I want to take a matrix of around 300 rows and 300 columns and put it into the form (row, column, number)
Any help would be appreciated a lot.
Thanks :)

Réponse acceptée

Michael Haderlein
Michael Haderlein le 3 Fév 2015
If m is your matrix:
m=rand(3,2);
[1+mod(0:numel(m)-1,size(m,1))' 1+fix((0:numel(m)-1)/size(m,1))' m(:)]

Plus de réponses (0)

Catégories

En savoir plus sur Shifting and Sorting Matrices dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by