LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

array to global array






i have a set of array, global..
i am currently adding to the array.
first, i add all the serial number into the array..
then i want to add the off, gain, reading, etc..

for instant..i am testing serial # 1.
i get the data and everything..
now i am testing serial # 2.

serial # 2 data is now in my element 0...

how do i do it so that my serial # 1, 2 , 3 , 4 , 5, 6, 7 is always in that order rather than in 7, 6, 5, 4, 3, 2, 1



Message Edited by krispiekream on 03-26-2008 07:32 PM

Message Edited by krispiekream on 03-26-2008 07:37 PM
Best regards,
Krispiekream
Download All
0 Kudos
Message 1 of 19
(3,689 Views)
Best regards,
Krispiekream
0 Kudos
Message 2 of 19
(3,684 Views)
To answer your question you would need to write a VI to rip through the serial number data and put them in the order you want.
 
From the looks of the images you posted you are using a lot of global and local variables.
Remember that every time you read and write to a local or global it will make a copy of this data in memory.
You can structure your code with action engines and state machines to avoide the use of globals and locals.
This will reduce the amount of time and memory your application will take.
0 Kudos
Message 3 of 19
(3,677 Views)
It's hard to tell what's going on exactly since you have shown a portion of code, and it seems to be using and abusing local variables.
 
I would guess it is that you are using the insert into array function.  Perhaps you should be using Build Array.  I find that in most instances, build array is the better choice over insert into array.  You might be constantly inserting your new data into the top of the array which is what would cause the array to appear in reverse order form what  you want.
Message 4 of 19
(3,657 Views)
Build array appends to the end of the array.
Like Raven said, you are using inserting which results in reverse order
Van L
NI Applications Engineer
0 Kudos
Message 5 of 19
(3,627 Views)

Seeing the construct of "Read from Global mod and write to Global" hits me like "finger-nails on the chalkboard". It is prone to race conditions as I discussed near the end of this Nugget on Action Engines.

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 6 of 19
(3,623 Views)
i tried using build array but that didnt work..
here is my vi, can someone help me take a look at it...thanks



Message Edited by krispiekream on 03-27-2008 04:08 PM
Best regards,
Krispiekream
0 Kudos
Message 7 of 19
(3,592 Views)


krispiekream wrote:
i tried using build array but that didnt work..
here is my vi, can someone help me take a look at it...thanks



Message Edited by krispiekream on 03-27-2008 04:08 PM

What do you mean it did not work?  What was it doing or not doing that was different from what you wanted?
 
I would say that in 99% of the use cases, build array is the more appropriate choice over insert into array.  Build array takes and array (even an empty array) and adds to the end of it.  Insert into array takes an array (even an empty array, but that usually isn't the case) and inserts data into the beginning, middle, or end depending on where you want it and what values you wire up to the indices.  Usually only useful if you are trying to use some sort of "database" type of array where you want to sort your values in some particular order.  If you just want to add data to the end, insert into array can do that, but it is far easier and less prone to error to use the build array function.
0 Kudos
Message 8 of 19
(3,584 Views)

@Ben wrote:

Seeing the construct of "Read from Global mod and write to Global" hits me like "finger-nails on the chalkboard". It is prone to race conditions as I discussed near the end of this Nugget on Action Engines.


Then I would suggest that you don't open the VI the user posted. You might just pass out. Smiley Very Happy
0 Kudos
Message 9 of 19
(3,579 Views)
hahaha, why is that?
too many local variables?
oh yeah..can someone show me how i can do the same work without using the local variables?
thanks

Best regards,
Krispiekream
0 Kudos
Message 10 of 19
(3,576 Views)