03-23-2009 05:10 AM
03-23-2009 06:10 AM
You can't do that with the in-place memory operators?
Could you post a code example to demosntrate whay you wna to do but can't?
Confused,
Ben
03-23-2009 06:33 AM - edited 03-23-2009 06:36 AM
So, why isn't there a node that has one source array (in), one destination array (in/out), an index (in) and length (in)?
There is:
Blog for (mostly LabVIEW) programmers: Tips And Tricks
03-23-2009 07:25 AM - edited 03-23-2009 07:27 AM
This is very slow, compared to how C does it. This is because the array subset has to be created, before it is inserted into the other array.
Regards,
Wiebe.
03-23-2009 07:40 AM - edited 03-23-2009 07:40 AM
..and this is what I would like to have...
So instead of:
Creating a new buffer allocation
The subset is copied to this new buffer allocation
Copy the new buffer to the destination array
We can simply:
Move the data from source to destination.
03-23-2009 07:40 AM
03-23-2009 07:47 AM
I fully agree, I'd also like this function. I just programmed a VI where this would have been useful.
I think it would have 2 array inputs, plus an index and a length for the portion of the source array to be copied and an index for the destination array.
It would basically be the combination of array subset and replace array subset, but without doing the copy first.
Very good idea... I hope to see this in a future version of LabVIEW!
Daniel
03-23-2009 07:49 AM - edited 03-23-2009 07:51 AM
This is how I envisioned the same code using the inplace operators.
Buffer "A" and "B" are created by the init arrays. Since A is not modified, buffer "A" is used as the source of the data.
Buffer "B" is really handled by the compiler (in the source code, like "A") so to make sure it is the same from run to run it is copied to buffer "C" where all of the work is done.
The lack of buffer allocation dots show that all of the rest of the work is done "in-place".
I hope that is getting closer to your concern,
Ben
03-23-2009 07:55 AM - edited 03-23-2009 07:57 AM
Is it something like this function. I think it appeared in Labview 8.6
03-23-2009 07:58 AM - edited 03-23-2009 08:01 AM
@Ben: This does it in place, that's correct. But instead of allocating an intermediate array it requires a for loop. This also slows things down if you have to copy big portions of the array.
Also, I think if you don't need the old value, there's no need for the in-place element structure because replace array subset should also be an in place operation.
I didn't do benchmarks, I think whether this method or the array subset / replace array subset combination is faster depends on the size of the portion to copy. One solution allocates memory, the other requires more CPU.
Daniel