how to store all values in one matrix in my code ?

8 views (last 30 days)
here start's my code see below and run my code after running my code you will get like this
r =
0
All cluster head:
X Y E D
20.8804 50.6459 0.9994 93.2509
66.3680 104.8504 0.9997 33.9800
80.0382 156.6456 0.9996 60.0599
84.6183 125.4252 0.9997 29.7159
84.7459 92.5260 0.9998 16.9867
121.3182 55.9365 0.9997 48.9496
135.9162 22.4920 0.9995 85.4252
147.9776 50.8509 0.9996 68.6840
178.1875 56.5368 0.9994 89.4558
183.0381 54.4672 0.9994 94.7025
189.6740 177.5828 0.9988 118.5770
199.6349 138.7574 0.9991 106.9076
up to r=5, and now i want to access all the values in one matrix like this
AllCH111(1).x1=[135.9162 22.4920 0.9995 85.4252
147.9776 50.8509 0.9996 68.6840
178.1875 56.5368 0.9994 89.4558
183.0381 54.4672 0.9994 94.7025
189.6740 177.5828 0.9988 118.5770
199.6349 138.7574 0.9991 106.9076];
AllCH111(2).x1=[135.9162 22.4920 0.9995 85.4252
147.9776 50.8509 0.9996 68.6840
178.1875 56.5368 0.9994 89.4558
183.0381 54.4672 0.9994 94.7025
189.6740 177.5828 0.9988 118.5770
199.6349 138.7574 0.9991 106.9076];
AllCH111(3).x1=[135.9162 22.4920 0.9995 85.4252
147.9776 50.8509 0.9996 68.6840
178.1875 56.5368 0.9994 89.4558
183.0381 54.4672 0.9994 94.7025
189.6740 177.5828 0.9988 118.5770
199.6349 138.7574 0.9991 106.9076];
like this want to get..and i have tried in my code it's self see last 'for loop'

Accepted Answer

Azzi Abdelmalek
Azzi Abdelmalek on 4 Dec 2014
The last for loop of your code is:
for r=1:rmax
AllCH111(r).x1=AllCH1(:,1);
AllCH112(r).y1=AllCH1(:,2);
CHbest1(r).x1=CHbest(:,1);
CHbest2(r).y1=CHbest(:,2);
end
In this loop AllCH1(:,1) is not varying, you need to put this inside the loop where ALLCH1 is varying
  7 Comments
Roja G
Roja G on 3 Nov 2020
Greetings of the day..!
sir i want to know how to connect basestation and cluster head,i want to know the link between ch and bs code.
sir could you please help me.
Thanx in advance.

Sign in to comment.

More Answers (0)

Tags

Community Treasure Hunt

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

Start Hunting!