From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Best way to create array from sampled signal???

I'm not sure exactly how to pose this question (been using labview for less than 2 weeks). I'm trying to graph the position of a motorized stage being run though an old Newport controller. I can obtain the position no problem. My sub-routine to get the position is in a while loop that repeats every 200 ms. I added a shift register to keep create an index to make the array, but it only stores the final position in the middle of the array, and puts zeros everywhere else (I initialized a large array outside the loop so it's basically just not writing anything except for that one value).

When I use the probe the index and position values change together, I just don't understand why it doesn't store.


Sorry if this is vague, I'm just not sure how to store these values to plot them. Any help is apprecated.

Thanks

Tim
0 Kudos
Message 1 of 8
(2,708 Views)
Tim,

Welcome to LabVIEW! Things can certainly get confusing for someone new at it.

It sounds like you are on the right path - shift register, initializing outside loop, etc. Please post your code and someone will likely be able to suggest a fix.

Lynn
0 Kudos
Message 2 of 8
(2,704 Views)
I'm unclear from you message exactly what you are doing with the shift register, but if you create an array outside the loop, of the maximum size expected (with a little more in case your guestimate is wrong) then use the loop index to index a "replace array subset" to replace the 0 value with your new value. Alternatively, create a null array of the right data type (an array constant) and do an append. Or just lead the value to the loop edge and enable indexing. The first two allow you to "see" the array during the running, the later one only allows you to see the results when the loop is stopped.


P.M.
Putnam
Certified LabVIEW Developer

Senior Test Engineer North Shore Technology, Inc.
Currently using LV 2012-LabVIEW 2018, RT8.5


LabVIEW Champion



0 Kudos
Message 3 of 8
(2,699 Views)
this is as far as I have got with it
0 Kudos
Message 4 of 8
(2,696 Views)
LV, sorry forgot to mention... I'm working with 6.0i unfortunately, not 7
0 Kudos
Message 5 of 8
(2,695 Views)
Sorry for the delay, I have been at a customer's, away from the internet. I am only running 7.1 at the moment, but here is a picture of what I was describing.


P.M.
Putnam
Certified LabVIEW Developer

Senior Test Engineer North Shore Technology, Inc.
Currently using LV 2012-LabVIEW 2018, RT8.5


LabVIEW Champion



0 Kudos
Message 6 of 8
(2,679 Views)
What are the outputs labeled as "array", "array 1"...etc I can't seem to find those in 6.

Thanks
0 Kudos
Message 7 of 8
(2,660 Views)
Once you've got the wire connected to the side of the loop, and indexing is enabled (right click on loop border->enable indexing), then right click on the indexing tunnel, and create->indicator. Those are just array indicators that LabVIEW has automatically named.
0 Kudos
Message 8 of 8
(2,656 Views)