06-14-2010 09:20 AM
Hello there
I'm relatively new to LabVIEW. Just a simple question. If I'm using arrays (index array,array subset, etc ) i have to connect a constant value to its index length to control the number of element as my output in my array.
What if my vi does not have a fix value of data?..And I'm not sure what value should I put in as my constant ?
Say, I want to extract a few elements from my 2-D array. Do i have to change my constant value at the subarray index? Or, is there a way to build some sort of counter to automatically pick the element that i needed instead of manually key-in and change the constant value repeatly??
Any comments are WELCOME!!.....Thanks!!
Guitar Girl
06-14-2010 09:26 AM
There are many ways to create counters in labview, but we need more details to help you.
Can you post a simplified VI ?
JD
06-14-2010 09:28 AM
If you don't know how many elements is within your array then you can use the 'Array Size' vi to find it.
But i am not sure if that's what you are asking.
06-14-2010 09:32 AM - edited 06-14-2010 09:34 AM
Please post an image of your code to help illustrates your question.
Now on to the guessing!
On the array palette there is an "array length" function (as Dimetrios posted)

that tells you how many elelements are in the aray. You can combine the value returned by the Array Length operator with functions from the Numeric pallette to add to subract from to change the value as you need.
Probably wrong with the guess so reply with clarification and images please.
Ben
06-14-2010 10:04 AM
Now,here's the vi. Yes, i thought of using array size. If you look at my vi, i have to build several array subset . Im just wondering do i need to build countless array subset and change the value at 'selection' every single time?
Have a look. Thanks. ..
06-14-2010 10:16 AM
"Im just wondering do i need to build countless array subset and change the value at 'selection' every single time? "
Please rephrase that question and we'll take a crack at answering it.
Ben
06-14-2010 10:19 AM
06-14-2010 10:26 AM
Well, it appears that you are indexing columns 1 and 2 specifically.
Are you saying that the data you want will not necessarily be in these locations all the time?
06-14-2010 10:32 AM
Let's say I want to get the value of the 3rd column of array2, i build an array subset with the index constant set to 2. If i want to get the value from the 4th column, i change the index constant as 3. I've labelled both as 'Selection'. So back to the question, if the array has 100 columns or rows, do i have to copy and paste again and again the array subset and just change the index labelled as 'Selection' ? I'm creating a GUI. Yes, it's tedious if i have to ask the user to key in the constant value repeatly.
Please advice. Thanks!
06-14-2010 10:40 AM
Still guessing!
Have you looked at using a For loop and letting the index "i" terminal serve for your math?
Ben