Could anyone help me how to consider the rows of matrix part by part.

1 回表示 (過去 30 日間)
jaah navi
jaah navi 2021 年 6 月 25 日
Code:
B = partitions(2);
G=rand(4,1);
P=rand(4,1);
for d=1:length(B)
for e=1:length(B{d})
for v =1:size(P,2)
for u =1:size(G,1)
Z(u,v) =(300.*log2(1+(((G(u,v)).*(P(u,v))/(0.5+sum(P(1:u-1,v)).*G(u,v))))))
end
end
end
end
In this code, B has two different types of partitions
For first partition {1 2}, I need to take first rows from G and P to calculate Z.
For second partition {1} {2}, I need to take third and fourth row from G and P to calculate Z.
But when I run the code it takes all the rows for G and P for each partition.
Could anyone help me how to take only first two rows for {1 2} and the next two rows for {1} {2}.

回答 (0 件)

カテゴリ

Help Center および File ExchangeCreating and Concatenating Matrices についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by