Populating matrix with coordinates of each element
Mostra commenti meno recenti
Hi Guys,
I am trying to populate a 100x100 matrix so that the first element is assigned to 1 and the last element is assigned to 100.
Any suggestions? I've already create the specified matrix using zeros and ones but I am guessing I have to use a nested for-loop with the outer looping over the rows and the inner looping over the columns to reassign each element?
Any assistance would be much appreciated.
5 Commenti
the cyclist
il 28 Ago 2021
You have not fully specified the matrix.
Let's take a smaller example: 3x3 matrix. Can you write out what you mean? For example, this is a matrix with the first element 1, and last element 3.
M = [1 0 0;
0 0 0;
0 0 3];
Is that what you mean?
Will Pihir
il 29 Ago 2021
Matt J
il 29 Ago 2021
That would be a 10x10 matrix, not 100x100.
Will Pihir
il 30 Ago 2021
Risposta accettata
Più risposte (0)
Categorie
Scopri di più su Matrix Indexing in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!