LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

in place element structure

I am trying to figure out how to use the in place element structure to replace the nested for loops below.  Essentially I am just subtracting a constant from each index in the array, a job fit for the inplace element structure.  Apparently I dont fully understand how to use the in place element strucutre, anyone care to shed a little light for me?

Thanks!





Message Edited by jmcbee on 06-09-2008 09:53 AM
0 Kudos
Message 1 of 8
(4,106 Views)

You can only access single elements with the array in/out feature of the in place element structure, not entire rows or columns.

I would just do the following:



Message Edited by altenbach on 06-09-2008 09:06 AM
Message 2 of 8
(4,091 Views)
Thank you altenbach.  Would placing an inplace element structure within that for loop, to do the subtraction in place, have any benefit?
0 Kudos
Message 3 of 8
(4,085 Views)
One optimisation could be to remove to inner for loop and subtract the value from the 1D array directly instead of doing them one by one.
Regards,
André (CLA, CLED)
Message 4 of 8
(4,081 Views)
It would depend on the size of the arrays. If the arrays are large then I would use the In place structure. If they are kind of small then just use it as it is.



Joe.
"NOTHING IS EVER EASY"
Message 5 of 8
(4,079 Views)
The arrays can be pretty large, large enough to use all available memory and have labview implode.  Down the line I write this large array to file.  I am currently using the write to spreadsheet.vi, this is usually where I get the "there is no available memory" message from labview.  I am guessing that the problem lies in converting the large 2D array into a string, using the array to spreadsheet string.vi that happens within the write to spreadsheet.vi.  Any thoughts on optimizing the process of writing a large 2D array to file?

Thanks
0 Kudos
Message 6 of 8
(4,073 Views)


jmcbee wrote:
Thank you altenbach.  Would placing an inplace element structure within that for loop, to do the subtraction in place, have any benefit?

Here's the version using the in place structure. I don't think it would provide any benefit. It just complicates the code. 😉
 
You can check for buffer allocations, but I think my original suggestion is the way to go. LabVIEW will do it very efficiently.
 

 


Message Edited by altenbach on 06-09-2008 09:19 AM
Message 7 of 8
(4,070 Views)
They went over this at the LabVIEW DevDay I went to.  Because the 2d arrays in altenbach's example (the beginning and end arrays) are the same size, LabVIEW will automatically do the operation in-place.
0 Kudos
Message 8 of 8
(4,043 Views)