Selecting specific rows and then summing them up
4 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Hi, suppose I have a matrix A=[1 2 3 4 5 6 7 8 9 10 11 13......12555], I want to select specific elements and add them up in one value. Selection is done after uniform interval. For example, I let the first value to be selected in 1 in the first row and then the next value I would select should be in the tenth row which is the value 10, the next value would be in the 20th row and so on. Then sum all these values together and find their mean. Kindly help me figure out how to go about it. Thanks.
0 Commenti
Risposta accettata
Chunru
il 15 Lug 2022
A=[1:12555];
B = A(10:10:end); % choose 10,20,30,...
mean(B)
3 Commenti
Stephen23
il 15 Lug 2022
A=[1:12555];
% ^ ^ totally superfluous, get rid of them.
Chunru
il 16 Lug 2022
@Stephen23 See the question https://www.mathworks.com/matlabcentral/answers/1761460-or-in-constructing-array
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Logical in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!