From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
11-30-2014 09:59 PM
Hi,
I want to do some operations to a portion of a large array.
I know two ways of doing it. First, by taking out the subarray and insert back into the main array. Another one is using the "in place element structure".
The structure typically gives better performance.
The portion is determined as in the attachment. I have not implement the diagram but the dummy output I want is as shown. The distance represent the number of elements from the center (including the center itself)
Could anyone suggest what is the best way of doing this (in diagram) such that it minimize memory and execution time (since my array is large and the application is targeted for real-time). FInally the modified subarray should be inserted back into the main array unless using the in place element structure.
Thanks a lot for any input.
12-01-2014 01:01 AM
I just manage to implement it. Attached are the VIs. Sorry for the messy wires. =P
If anyone has any idea on how to improve the execution time, memory and structure, please let me know. The array is large and operation may be much more than as shown in the program.
I have not manage to implement the solution using the in place element structure yet since it does not allow replacing array subset.
12-01-2014 02:35 AM
Hi,
I admit I've no idea what you're trying to do and why, but here is your code implemented using an in place structure. If the Center coordinate is given in 0 based indexing (so that in a 3x3 array, the center would be (1,1)) this gives the same result as your code. As I've no idea what parameters to put in this could be way off, but the in place structures used might give you an idea. Note that in the inner in place structure the split dimension is 1, and in the outer the split dimension is 0 (right click->split dimension).
Good luck,
Danielle
12-01-2014 04:34 AM - edited 12-01-2014 04:35 AM
It can be enhanced certainly.
- avoid building case structures for easy operations. There is a trade off [time-wise] between building the case structure and calculating some extra values. Benchmarking needed.
- use the in-place structure as dsavir has suggested. I modified his, becuase it was not working for me, and I had to use a lot of "transposing 2D array". Again, benchmarking needed for your case.
Enhance readability by using proper representations (I32 vs DBL for indexes).
I think the distance from the center (DFC) should be redefined. It should be one less. Which elemenets are selected for 0 and 1, in your case? IMHO, DFC=0: a single element / no elements around, DFC=1: 3x3 elements,... You have DFC=2: 3x3 elements. DFC=0:??? I couldn't bare this so, I redefined it for me.
If you are keen on the best timing, you might want to benchmark the three suggestons archived and attached below. Let us know.
Cheers,
12-01-2014 04:42 AM
Hi,
To avoid transpose arrays, change the split dimension in the in place element structure (right click->split dimension).
Thanks,
Danielle
12-01-2014 05:02 AM
Right. Never though of the "zero" in the icon. Thanks!
12-01-2014 08:11 AM
@dsavir wrote:
To avoid transpose arrays, change the split dimension in the in place element structure (right click->split dimension).
Wow I did not know that, kudo'd. Still I've heard the transpose is like a no-op more or less. Also why doesn't the primative split array support this feature?
Unofficial Forum Rules and Guidelines
Get going with G! - LabVIEW Wiki.
16 Part Blog on Automotive CAN bus. - Hooovahh - LabVIEW Overlord
12-01-2014 08:15 AM
@Hooovahh wrote:
Also why doesn't the primative split array support this feature?
The primitive works only for a 1D array, doesn't it?
12-01-2014 08:19 AM
@ghighuphu wrote:
The primitive works only for a 1D array, doesn't it?
Right...but why should it be limited in such a way, if the IPE structure isn't held to the same limitations?
Unofficial Forum Rules and Guidelines
Get going with G! - LabVIEW Wiki.
16 Part Blog on Automotive CAN bus. - Hooovahh - LabVIEW Overlord
12-01-2014 08:20 AM