How can I add an index value to an array value?
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
dormant
am 17 Jun. 2022
Kommentiert: dormant
am 17 Jun. 2022
I have an array of reals, like this.
0.1 0.1 0.1 0.1
0.2 0.2 0.2 0.2
0.1 0.2 0.3 0.4
How can I add the horizontal index value, so that the array ends up like this?
1.1 2.1 3.1 4.1
1.2 2.2 3.2 4.2
1.1 2.2 3.3 4.4
I could easily do it with a loop, but I'm convinced there is a one-line solution. I just can't see it.
PS the array is a lot larger than the example.
0 Kommentare
Akzeptierte Antwort
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Matrix Indexing finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!