How to concatenate value calculated in a for loop?
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
In matlab, if I have a code that calculates the rate of something in a for loop like this
for t=1:10
Ratek=(1/2)*(log2(1+SINR1k)+log2(1+SINR2k));
end
and each time the value of the rate differs, I want in to concatenate all the values of this rate in each loop so that after the 10th loop I have the 10 rates calculated to use them. How can I do this ?
0 Kommentare
Antworten (1)
Matz Johansson Bergström
am 19 Jul. 2014
I guess you want to place the values in a vector?
Ratek = zeros(10,1); %preallocate vector
for t=1:10
Ratek(t) = (1/2)*(log2(1+SINR1k)+log2(1+SINR2k));
end
Is this what you need?
0 Kommentare
Siehe auch
Kategorien
Mehr zu Creating and Concatenating Matrices finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!