06-01-2021 10:02 PM
Hello,
I am attempting to repeat code for 30 iterations and each iteration needs to be for certain sample lengths. Each iteration of data would be written to a text file. Automated calculations in this way are new to me. I think I need to use a shift register but I am only getting 30 iterations of data for the first iteration. I simply cannot figure out how to get the 2nd, 3rd, etc. iterations to calculate for later sample lengths.
I would greatly appreciate any assistance!
06-03-2021 09:58 AM
A potential issue that I can see is in the searching of the VEL array within the main loop.
As an example, assume that on the first loop iteration, the value of 1st Loop Length (samples) is 25 and 2nd Loop Length (samples) is 12. The value sent to the shift register is 37 and on the second loop iteration the VEL array is searched from index 37 onwards. Assume that now the value of 1st Loop Length (samples) is 18 (i.e. the 55th element of VEL) and 2nd Loop Length (samples) is 14. The value sent to the shift register is 32 and on the third loop iteration the VEL array is searched from index 32 onwards. This, presumably, is not what you want.
If what you intend to do is start each search from the point at which the last one finished, you'll need to add the previous shift register value to the sum of the Loop Length variables and pass this value to the shift register instead.
06-03-2021 10:20 AM
Hi PsyenceFact,
Thank you for your for this suggestion. I actually just figured out the resolution a moment ago. I needed to perform the following calculation and feed the result into the input of my subset arrays: multiply the iteration number (from the large for loop) times the sample length between each iteration (which is consistent) and then add the number of samples where my first iteration begins.
06-03-2021 10:29 AM
Glad you've sorted it out. In my experience, having someone else look at a problem is often enough for me to see the problem for myself!