How do I store all values of a loop in a vector?
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Matthew
am 12 Apr. 2024
Kommentiert: Dyuman Joshi
am 19 Apr. 2024
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
1 Kommentar
Dyuman Joshi
am 19 Apr. 2024
An alternate method without loop -
x = randi(6,1,1e5) + randi(6,1,1e5);
Akzeptierte Antwort
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Loops and Conditional Statements finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!