LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

help with 5D array

Hi estomax,

after looking more carefully at your code I also found way too much locals in the init part of your vi.
See the changes I made in the attached pic, you will notice:
- no locals needed anymore!!!
- used some improved constructs (like doing math on array instead of scalars in a loop)

I think this was the source of your problems: by using locals in the init part you created a lot of race conditions.
Use wires whenever possible! Inside a single vi they are always possible!

Found another possible problem:
When building your "CapArray4D" you use "Replace Array Subset". But you initialize the array with zero elements in 4th dimension.
You will get into trouble when trying to replace non-existing array elements... Either init the array with correct dimension size (recommended way) or use "build array" instead of replace function (will be problematic when array grows large)!


Message Edited by GerdW on 07-26-2008 11:47 AM
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 11 of 17
(1,474 Views)

hey Gerd,

Thanks for the reply! I took your tip and simplified my sequence structure, but it still didnt work after that. But having everything in front of me helped me figure out that i was indexing the array wrong, i was supposed to 3d frequency at the bottom-most index and the z-slice at the one above it. It seems to be working correctly now. There are a few other bugs im playing with, hopefully i can figure those out on my own.

How do i rate your post? I can't seem to figure it out...

thanks!
Marko

0 Kudos
Message 12 of 17
(1,422 Views)
Hey,

I have the program mostly fixed, but i am running into some strange buffer problem. If i make my array big, such as 250x250x250x20 for example, i can click run on the VI and it will take up about 60mb of memory and start running. When i click stop, and then click run again (to restart the VI), the program will chew up all the memory and virtual memory and the computer crashes soon after i get a low virtual memory message. Is there a way for me to set LabView to clear any previous memory usage before running the program or does anyone see whats going on here?

cheers for any input!
Marko
0 Kudos
Message 13 of 17
(1,398 Views)
Your array will be 2.5 GB, so I am even surprised it will run once.

Ton
Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
Nederlandse LabVIEW user groep www.lvug.nl
My LabVIEW Ideas

LabVIEW, programming like it should be!
Message 14 of 17
(1,385 Views)

... and if you are still using locals then keep in mind there is copy of the data made for every instance of the local.

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 15 of 17
(1,374 Views)

Hey Guys,

Thanks, 2.5GB Smiley Surprised!!! ok I will tell my prof thats why it won't work then haha.

Also, i am a little confused on locals, are they the references that I make to reference an array (or other variable) in a different frame? I thought those work like pointers (like in other programming languages). If not, is there a way to use pointers instead of whole copies? I did follow Gerd's advice and get rid of the ones he pointed out.

Thanks!
Marko



Message Edited by estomax on 07-30-2008 10:08 AM
0 Kudos
Message 16 of 17
(1,349 Views)
Hi
They are not like pointers.  What a local does is create a copy of the data so that it can be read elsewhere within LabVIEW. This leads towards race conditions within the code as different parts of the program can access / write to the local at undefined times.  To avoid all that fuss you should try to move data around the code with wires (Especially with large array sizes).  Even then sometimes LabVIEW still takes a copy of the data but there are no longer any race conditions as dataflow forces the execution of the code.
 
Craig


Message Edited by craigc on 07-30-2008 10:46 AM
LabVIEW 2012
0 Kudos
Message 17 of 17
(1,340 Views)