I want to sort an array of numbers based on how large they are.
I want to run a loop using the values of an array so that it iterates each value individually. I will try to get it into somekind of psuedo code. I havent programmed in 3 years.
PL=(3,5,7,9,10);
EL=(3,2,2,2,1);
n=input;
x=array;
gp=2.5*(1:n)
% I want this to run for each value of PL seperately
for each PL_i in PL
x=(EL(1,1) < gp <= PL);
% ...and then the vector x subtracted from each value of EL
gp2=(x-(EL);
% ...and then put those values from gp2 back into an array
end
Thanks for helping anyone I have worked on this program many hours. This step would greatly aid the entire project.
I can accomplish this using multiple if loops….
g=(gp(gp>0));
gp1=(gp(gp<=EL(1,1)));
if x1>=2
x=(gp((EL(2,1)<gp)));
pp=(gp(gp<=PL(2,1)));
gp2=[x,pp];
gpp2=(x-(EL(2,1)));
lpap=([gp1,gpp2]);
end
if x1>=3
x=(gp((EL(3,1)<gp)));
pp=(gp(gp<=PL(3,1)));
gp2=[x,pp];
gpp3=(x-(EL(3,1)));
lpap=([gp1,gpp2,gpp3]);
end
Alright so I got it, I ended up changing how I wrote the program.