Borrar filtros
Borrar filtros

So ima trying to get a matrix from a nested loop but i keep getting a one answer SIGMA in the workspace but thanks to the disp(SIGMA) i get a bunch of numbers in the command window. Why are they different?

1 visualización (últimos 30 días)
for x=0:30
for y=0:30
SIGMA=(x*y);
end
end

Respuestas (1)

Walter Roberson
Walter Roberson el 27 de Nov. de 2017
Change
SIGMA=(x*y);
to
SIGMA(x+1,y+1) = (x*y);

Categorías

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

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by