how to extract the overwritten values inorder to plot the graph

Could anyone tell me how to extract the overwritten values to plot the graph.

5 commentaires

How and why the values are over written? We cannot help you unless code is shown.
code:
for t= 1:length(N_UE)
list_of_N_rng={[1,2,3,4],[5,6,7,8,9]};
for seed_idx = 1 : length(list_of_N_rng)
N_rng=list_of_N_rng{seed_idx};
for s=1:length(N_rng)
....
...
...
output1(t,s)=overall_throughput1 % final result of throughput calculation
...
...
end
end
end
dummyX = 1:length(list_of_N_rng);
figure
plot(dummyX,output1,'rs');
hold on;grid on;
for the above code i can get the values for [5,6,7,8,9] displayed on the graph.But i couldnt get the values for [1,2,3,4].Could you please help me on this.
Check to see if output1(1) is nan or inf
yes that data was different one. For the list_of_N_rng={[1,2,3,4],[5,6,7,8,9]}; the results are
Below results are for rng = 1
output1 = 1.9341e+10
Below results are for rng = 2
output1 = 1.0e+10 * 1.9341 1.6240
Below results are for rng = 3
output1 = 1.0e+10 * 1.9341 1.6240 1.9231
Below results are for rng = 4
output1 = 1.0e+10 * 1.9341 1.6240 1.9231 1.6755
Below results are for rng = 5
output1 = 1.0e+10 * 2.0917 1.6240 1.9231 1.6755
Below results are for rng = 6
output1 = 1.0e+10 * 2.0917 1.8071 1.9231 1.6755
Below results are for rng = 7
output1 = 1.0e+10 * 2.0917 1.8071 2.0985 1.6755
Below results are for rng = 8
output1 = 1.0e+10 * 2.0917 1.8071 2.0985 1.8008
Below results are for rng = 9
output1 = 1.0e+10 * 2.0917 1.8071 2.0985 1.8008 1.3841

Réponses (1)

Walter Roberson
Walter Roberson le 6 Avr 2018
You are three loops deep at the point you assign to output1(), but you only index output1 with the first and third loop variables. Everything for the second loop (seed_index) is going to be overwritten.

4 commentaires

ok.could you please help me how to index output 1 with respect to first,second and third loop variables.
I have modified
output1(t,s)=overall_throughput1
to
output1(t,seed_idx,s)=overall_throughput1
and I am getting the following output
Below results are for rng = 1
output1 =
1.8380e+10
Below results are for rng = 2
output1(:,:,1) =
1.8380e+10
output1(:,:,2) =
2.0014e+10
Below results are for rng = 3
output1(:,:,1) =
1.8380e+10
output1(:,:,2) =
2.0014e+10
output1(:,:,3) =
1.8425e+10
Below results are for rng = 4
output1(:,:,1) =
1.8380e+10
output1(:,:,2) =
2.0014e+10
output1(:,:,3) =
1.8425e+10
output1(:,:,4) =
2.0771e+10
Below results are for rng = 5
output1(:,:,1) =
1.0e+10 *
1.8380 1.9754
output1(:,:,2) =
1.0e+10 *
2.0014 0
output1(:,:,3) =
1.0e+10 *
1.8425 0
output1(:,:,4) =
1.0e+10 *
2.0771 0
Below results are for rng = 6
output1(:,:,1) =
1.0e+10 *
1.8380 1.9754
output1(:,:,2) =
1.0e+10 *
2.0014 2.1991
output1(:,:,3) =
1.0e+10 *
1.8425 0
output1(:,:,4) =
1.0e+10 *
2.0771 0
Below results are for rng = 7
output1(:,:,1) =
1.0e+10 *
1.8380 1.9754
output1(:,:,2) =
1.0e+10 *
2.0014 2.1991
output1(:,:,3) =
1.0e+10 *
1.8425 2.0028
output1(:,:,4) =
1.0e+10 *
2.0771 0
Below results are for rng = 8
output1(:,:,1) =
1.0e+10 *
1.8380 1.9754
output1(:,:,2) =
1.0e+10 *
2.0014 2.1991
output1(:,:,3) =
1.0e+10 *
1.8425 2.0028
output1(:,:,4) =
1.0e+10 *
2.0771 2.1659
Below results are for rng = 9
output1(:,:,1) =
1.0e+10 *
1.8380 1.9754
output1(:,:,2) =
1.0e+10 *
2.0014 2.1991
output1(:,:,3) =
1.0e+10 *
1.8425 2.0028
output1(:,:,4) =
1.0e+10 *
2.0771 2.1659
output1(:,:,5) =
1.0e+10 *
0 2.1944
Now could you please help me to plot the values of [1,2,3,4] and [5,6,7,8,9] separately in one graph.
I am confused about what the differences are between the three different questions you have going that look to me to all be about the same topic.
Sorry to confuse.What I actually need is I want to plot the values for [1,2,3,4] and [5,6,7,8,9] separately in one graph for the following code
for t= 1:length(N_UE )
list_of_N_rng={[1,2,3,4],[5,6,7,8,9 ]};
for seed_idx = 1 : length(list_of_N_rng )
N_rng=list_of_N_rng{seed_idx };
for s=1:length(N_rng )
....
...
...
output1(t,seed_idx,s)=overall_throughput1 % final result of throughput calculation
...
...
end
end
end
dummyX = 1:length(list_of_N_rng );
figure
plot(dummyX,output1,'rs ');
hold on;grid on;
If i run the code the result which I am getting are
Below results are for rng = 1
output1 =
1.8380e+10
Below results are for rng = 2
output1(:,:,1) =
1.8380e+10
output1(:,:,2) =
2.0014e+10
Below results are for rng = 3
output1(:,:,1) =
1.8380e+10
output1(:,:,2) =
2.0014e+10
output1(:,:,3) =
1.8425e+10
Below results are for rng = 4
output1(:,:,1) =
1.8380e+10
output1(:,:,2) =
2.0014e+10
output1(:,:,3) =
1.8425e+10
output1(:,:,4) =
2.0771e+10
Below results are for rng = 5
output1(:,:,1) =
1.0e+10 *
1.8380 1.9754
output1(:,:,2) =
1.0e+10 *
2.0014 0
output1(:,:,3) =
1.0e+10 *
1.8425 0
output1(:,:,4) =
1.0e+10 *
2.0771 0
Below results are for rng = 6
output1(:,:,1) =
1.0e+10 *
1.8380 1.9754
output1(:,:,2) =
1.0e+10 *
2.0014 2.1991
output1(:,:,3) =
1.0e+10 *
1.8425 0
output1(:,:,4) =
1.0e+10 *
2.0771 0
Below results are for rng = 7
output1(:,:,1) =
1.0e+10 *
1.8380 1.9754
output1(:,:,2) =
1.0e+10 *
2.0014 2.1991
output1(:,:,3) =
1.0e+10 *
1.8425 2.0028
output1(:,:,4) =
1.0e+10 *
2.0771 0
Below results are for rng = 8
output1(:,:,1) =
1.0e+10 *
1.8380 1.9754
output1(:,:,2) =
1.0e+10 *
2.0014 2.1991
output1(:,:,3) =
1.0e+10 *
1.8425 2.0028
output1(:,:,4) =
1.0e+10 *
2.0771 2.1659
Below results are for rng = 9
output1(:,:,1) =
1.0e+10 *
1.8380 1.9754
output1(:,:,2) =
1.0e+10 *
2.0014 2.1991
output1(:,:,3) =
1.0e+10 *
1.8425 2.0028
output1(:,:,4) =
1.0e+10 *
2.0771 2.1659
output1(:,:,5) =
1.0e+10 *
0 2.1944
But I am unable to get the graph for the above result.
Could you please help me to solve it.

Cette question est clôturée.

Tags

Clôturé :

le 20 Août 2021

Community Treasure Hunt

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

Start Hunting!

Translated by