Borrar filtros
Borrar filtros

How to add matrix to previous matrices after every iteration?

4 visualizaciones (últimos 30 días)
zephyr21
zephyr21 el 20 de Jun. de 2016
Respondida: Adam el 20 de Jun. de 2016
So I have an 11x14 matrix with only two numbers in it, the rest are zeros. These two numbers will change with every iteration (from 1 to 60). The goal is to add every iteration to the previous, then when its done add the two numbers together. What would be a good way to do this? Preferably ending with just one singular number without all the zeros from the matrix.

Respuestas (1)

Adam
Adam el 20 de Jun. de 2016
Why don't you just use a 1x2 matrix if all the rest of the points will always be 0?
Either way I don't really get the problem though.
a = a + newIterationValues;
will add one array to another of the same size and can be placed within a loop to accumulate values.

Categorías

Más información sobre Loops and Conditional Statements en Help Center y File Exchange.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by