Info

This question is closed. Reopen it to edit or answer.

How to handle this loop?

1 view (last 30 days)
Abhinav
Abhinav on 22 Mar 2015
Closed: MATLAB Answer Bot on 20 Aug 2021
I have a loop in my code as below
for i=1:n-1
k=1:sz1;
temp=rand(1,sz1)
if temp(1,:)<=0.6
QAKAN1(i,k)=QAKAN11(:,k).*temp(:,k)
QAKAN11=QAKAN11(:,k)-QAKAN1(i,k)
end
end
QAKAN1
where 'n' and 'sz1' are integers. The problem is that if temp is greater than 0.6, it is executing the loop and returning the result as 0.
0 0
182.93 1789.8
0 0
249.72 682.57
Please help in solving the problem.
QAKAN11= 1125 3323

Answers (0)

Tags

Community Treasure Hunt

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

Start Hunting!