I have got two matrices, 1st one has probability in it and second one has values of power corresponding to each probability and both have 1 row and 100 columns. Now i want to generate 10000 random numbers between 0-1 which are compared to the probability and if satisfy a certain condition, the output from corresponding power matrix should be given. I have written the code but am getting an error "matrix dimension must agree". Can any on let me know hat mistake i am making here.
a=rand(1,10000);
for q=1:1:99
praq=pr(1:1:99);
pwaq=pw(1:1:99);
end
if a<praq
pwaq
else if a>=praq and a<praq+1
pwaq+1;
end
end
exit
Where pra is the probability, pwa is the power. I want to check if random number i.e. a is less than pra's first element, it should give output from pwa's 1st element. if not, it should check for second element of pra and so on till 100th element. This procedure should be repeated 10000 times.