Quote:
Originally Posted by hunter Sorry for the confusion and being unclear on what i'm after. I not very code literate with my lingo and skills. I know in my mind what I want the code to do. Let me try to make this clearer what i'm after.
How is the points cloud being cut down each time though, this is the part where i need the loop at. I start with 128 then decrease to 64..32..16..8...4..2..1.. .5... .25. My thoughts are that you would set an integer at this part in the code (where the red 64 is at on previous reply). So set this as L. So what i want on the first run I need the value set at 128, and on the second run set L equal to 64. Basically I need a loop to decrease L by 1.5 each time untill L equals .25. To add to this I would like easily be able to change the fraction that i decrease the point cloud by for future use.
Thanks, for the help so far. |
You initialise a variable to 128 outside the loop, after the processing in the loop (that's in the loop at the bottom) you halve the variable, then on the next trip around the loop you have a value of 64, then 32, ...
You will find this all easier to do if you move all the actual processing inside the loop into a seperate function, so you can differentiate between the loop logic and the processing itself.
Also do not use variable names which depent on the loop index (that is don't use x_1 for the value of x first time around x_2 second time around etc. If these are not to be persistent just use x. This means you can actualy use a loop, which you can't do otherwise.
also consider designing with the aide of psuedo-code:
Code:
L=128
for idx =1 : 20
if idx==1
read from original input file
set file name for first output file
else
read from last output file
set file name for next output file
end
%do calcuations
write output file
do any other plotting, printing etc
L=L/2
end
RonL