How do I create a matrix such as a matrix L of the data matrix M as shown below..?
2 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Yuli Hartini
il 2 Gen 2017
Modificato: Image Analyst
il 2 Gen 2017
I have matrix M below
M = [1 2 0.2
2 3 0.4
3 4 0.22
4 5 0.1
5 6 0.5]
How do I create a matrix such as a matrix L of the data matrix M as shown below..?
L = [0.2
(0.4+0.2)
(0.22+0.4+0.2)
(0.1+0.22+0.4+0.2)
(0.5+0.1+0.22+0.4+0.2)
]
0 Commenti
Risposta accettata
Image Analyst
il 2 Gen 2017
Try this:
L = cumsum(M(3:3:end))
2 Commenti
Image Analyst
il 2 Gen 2017
Modificato: Image Analyst
il 2 Gen 2017
Right. That's what I had in her original question (a separate discussion thread), which was a 2-D matrix. This question used to be a row vector. Now she changed this one from a row vector to a 2-D matrix and somehow her other question, with the 2-D matrix that I answered exactly like you did, is now gone.
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Logical in Help Center e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!