How do I store all values of a loop in a vector?

3 visualizzazioni (ultimi 30 giorni)
for i=1:100000;
x=randi(6)+randi(6);
end;
I am trying to find an average across all values of x and need to save them all as a vector and can't figure out how

Risposta accettata

Voss
Voss il 12 Apr 2024
x = zeros(1,100000);
for i=1:100000
x(i)=randi(6)+randi(6);
end

Più risposte (0)

Categorie

Scopri di più su Loops and Conditional Statements 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!

Translated by