How to concatenate value calculated in a for loop?

1 次查看(过去 30 天)
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 ?

回答(1 个)

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

类别

Help CenterFile Exchange 中查找有关 Creating and Concatenating Matrices 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by