How to assign the values to a matrix?
15 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Benson Gou
am 26 Mai 2021
Bearbeitet: Stephen23
am 26 Mai 2021
Dear All,
I have a zero matrix A whcih needs to be assigned values from an column vector B. The indecies of those elements are stored in a two-columns array C.
For example, B = [1 9 12 31], C = [1 4;3 6;5 2;6 3]. Then matrix A is =[0 0 0 1 0 0; 0 0 0 0 0 0; 0 0 0 0 0 9;0 0 0 0 0 0; 0 12 0 0 0 0;0 0 31 0 0 0].
Thanks a lot.
Benson
0 Kommentare
Akzeptierte Antwort
Weitere Antworten (0)
Siehe auch
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!