Hi Evangelos
It is my understanding that you would like to iteratively append the 'jammer' and 'evas' positions to an array when a specified condition is satisfied.
As the dimension of the variables 'jammer' and 'evas' is [1x3], a possible workaround is to use 'cell arrays' to store the value of the variables in every iteration whenever the specified condition is satisfied.
The following code illustrates the use of cell arrays as mentioned above:
Rt= 30;
ALL_jammer_pos= {};
ALL_eavs_pos= {};
for ii=1:1:10000
for iii=1:1:1000
jammer_posx = randi([-500 500],1,1);
%fprintf('%d', jammer_posx);
jammer_posy = randi([-500 500],1,1);
eavs_posx = randi([-500 500],1,1);
eavs_posy = randi([-500 500],1,1);
H=30;
jammer= [jammer_posx jammer_posy H];
eavs= [eavs_posx eavs_posy H];
NCS_r= 40;
if NCS_r >= Rt
ALL_jammer_pos{end+1}= jammer;
ALL_eavs_pos{end+1}= eavs;
end
end
end