Jump to content

Dynamic Array Size


Recommended Posts

I'm having issues all over the place... I think my company put up a block on posting things on the internet, which means I have to somehow find the answer to this problem by explaining it rather than showing you. It's not difficult and I feel retarded about it but I can't figure it out:

i can easily explain whats on the vi. its a simple nested for loop with two array feeding into it. one is a time array the other is an array with values for 26 channels at each of those times. inside the for loops the array is indexed and there is a inequality sign checking to see if the value goes over 2. if it does... i want the program to create a seperate 3D array: channel, value, and time. if it doesnt go over 2 then i want the program to disregard the value and continue. simple enough? i tried creating the array inside the case structure after it checks the value... but when the case is false, the tunnel still requires an output.

biggest issue: array coming out of the for loop has a different size than the one going in and it needs to be based completely on the values in the array going in and they change everytime on every channel.

thanks

Link to comment

What you're missing is a shift register to pass the results array through the case structure if it hasn't changed. Shift registers will hold values and pass them into the next iteration of the loop, so if you initialize it with an empty results array of the type you want out of the loop, you can add/delete/sort it as you please through each iteration.

If I understood your explanation, Something like this would work (TRUE and FALSE case shown seperately for clarity, there would just be one loop on your BD):

http://forums.lavag.org/index.php?act=attach&type=post&id=6482

Link to comment

QUOTE(abuch06 @ Jul 27 2007, 10:07 AM)

I'm having issues all over the place... I think my company put up a block on posting things on the internet, which means I have to somehow find the answer to this problem by explaining it rather than showing you. It's not difficult and I feel retarded about it but I can't figure it out:

Try a different browser. I can't upload images when I'm using Firefox, but I can using MSIE and Safari. I believe Michael is aware of the issue.

Link to comment

QUOTE(abuch06 @ Jul 27 2007, 03:07 PM)

I'm having issues all over the place... I think my company put up a block on posting things on the internet, which means I have to somehow find the answer to this problem by explaining it rather than showing you. It's not difficult and I feel retarded about it but I can't figure it out:

i can easily explain whats on the vi. its a simple nested for loop with two array feeding into it. one is a time array the other is an array with values for 26 channels at each of those times. inside the for loops the array is indexed and there is a inequality sign checking to see if the value goes over 2. if it does... i want the program to create a seperate 3D array: channel, value, and time. if it doesnt go over 2 then i want the program to disregard the value and continue. simple enough? i tried creating the array inside the case structure after it checks the value... but when the case is false, the tunnel still requires an output.

biggest issue: array coming out of the for loop has a different size than the one going in and it needs to be based completely on the values in the array going in and they change everytime on every channel.

thanks

Based on what u say the indexing of a forloop or while loop will not work for you.

Instead you must create (or input) the arrays from outside the loop into a shift register then inside the loop do the comparison.

Use index array to get at the element you want to compare. If its >2 add an element to your 3D array then cycle it back through the shift register.

If its <=2 simply pass the array through it to the shift register unchanged.

That way the array will not grow until your condition is met, regardless of how many checks are made based on the other arrays being input to the loop.

It is not efficient but it will work,

Duh

Orko beat me to iit.

Link to comment

QUOTE(torekp @ Jul 31 2007, 04:14 PM)

Paul, you might be interested in the Code Capture Tool. Just place the LLB in your LabVIEW\Project folder and you will have the CCT option in the Tools menu after you restart LV and it will capture the VI you open it from.

Link to comment

QUOTE(yen @ Jul 31 2007, 12:04 PM)

Hey, Thanks for the link! I've been doing this manually!!! The file path option to save it to a temporary directory and load the path into the clipboard is perfect for LAVA. :thumbup:

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.