ctr26 Posted October 30, 2015 Report Posted October 30, 2015 Hi All, I have 3 analogue and 2 digital waveforms that I want to repeat multiple times with a delay between them. I could do this programmatically using a while loop during their playback but ideally I'd like to create a waveform as a delay and concatenate them all so that the resultant waveform is the what will be sent. My current solution is to have a pair of for loops inside a larger for loop. The sub for loops concatenate the waveforms with the shift registered waveforms and then with a waveform of my choosing (the delay waveform). Attached is a snippet of code. However, to produce a waveform that has 200 repeats takes around 20 seconds to build. This is not ideal and considering it is just array manipulation I feel like there is a fast way of doing this using the in place operator, but I don't personally know how. Any advice welcome, Thanks, Craig Quote
ensegre Posted October 30, 2015 Report Posted October 30, 2015 Growing large arrays in loops, which is what you're doing, is slow at any rate, because it involves reallocating and copying at each iteration. I would preallocate the array Y and fill it in the loop with replicas of the basic chunk. 1 Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.