How to concatenate value calculated in a for loop?

1 view (last 30 days)
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 ?

Answers (1)

Matz Johansson Bergström
Matz Johansson Bergström on 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?

Categories

Find more on Creating and Concatenating Matrices in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!