LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to build an array using incoming stream of data?

Solved!
Go to solution

@altenbach wrote:

I am still up 😉


I just woke up.Smiley Mad(morning face)

-----------------------------------------------------------------------------------------
Reese, (former CLAD, future CLD)

Some people call me the Space Cowboy!
Some call me the gangster of love.
Some people call me MoReese!
...I'm right here baby, right here, right here, right here at home
0 Kudos
Message 11 of 26
(1,334 Views)

Do you mean like this (see attached)?

But it doesn't work, because as I increment the index, the previous element which was replaced would switch back to its original value. eg.

 

Input array: 0 0 0 0 0 0

Index: 3

New element: 8

Output array: 0 0 0 8 0 0

 

if I go on to replace the next element, i.e:

Index: 4

New element: 99

Output array becomes 0 0 0 0 99 0

 

 

0 Kudos
Message 12 of 26
(1,331 Views)

Can you explain what you mean by the VBAI program "feeds" data to a front panel indicator? How did you implement that? How does the LabVIEW program know when new data arrives? Is this called as a subVI?

By "feeds", I meant I have a control in LabVIEW front panel, say for example (for simplicity's sake), a numeric indicator my_indicator in front panel.

In my VBAI, I have a measurement value which is called my_data; and in this VBAI program I am using LabVIEW front panel interface. I will call the step "Update UI" in which I set the my_indicator to my_data.

 

LabVIEW would not know the exact timing of the arrival of the stream of data. For example, the first data arrives at 0s, the second 0.1s, but the third 0.5s.

0 Kudos
Message 13 of 26
(1,327 Views)

@splee wrote:

Do you mean like this (see attached)?

But it doesn't work, because as I increment the index, the previous element which was replaced would switch back to its original value. eg.

 

 



How are you using this?  This is a simple VI that does only one thing.  Are you planning on using this as a subVI that is a part of a loop in a main VI?  You don't have any terminals wired up on the connector pane.

 

If you are only trying to run this as a VI, you are getting exactly what it is programmed to do.  Take an array from a control, replace and element, and show it on an indicator.  You don't have any kind of loop and you don't have any mechanism for feeding the indicator results back into the control.  Is that what you are expecting it to do?

Message 14 of 26
(1,325 Views)

@MoReese wrote:

@altenbach wrote:

You can eliminate that useless FOR loop by using a globally initialized feedback node instead of a shift register.

You also need a mechanism to reset the shift register contents.


Dear altenbach,

what is this icon (see attached)?

 

 

 

 

 


 

0 Kudos
Message 15 of 26
(1,322 Views)

An empty DBL array diagram constant.

Message 16 of 26
(1,312 Views)

this one does not work..

all elements of the appended array are the same, i.e

if numeric control is 1, the array is 1 1 1 1 1 1 1 ..

if numeric control is now changed to 2, the array becomes 2 2 2 2 2 2 2 ...

maybe you need to use Build Array control (concatenate) with as many array input terminals?


@MoReese wrote:

@altenbach wrote:

You can eliminate that useless FOR loop by using a globally initialized feedback node instead of a shift register.

You also need a mechanism to reset the shift register contents.


What are you doing up at this hour?  Don't you sleep?  Per your advice.  The OP will still need to code in an initial state for the array.

 

array.png

 

 

 




0 Kudos
Message 17 of 26
(1,311 Views)

How are you running/calling this?

Message 18 of 26
(1,309 Views)
Solution
Accepted by splee

You must be running this in a loop.  Yes, the array will fill quickly if this is the case.  This was intended to execute upon a value change.  In other words, you call it when there is a new value or when you want to store the next value.  With every iteration, the value of the numeric control will be appended to the array.  What are you needing exactly?

 

array.png

-----------------------------------------------------------------------------------------
Reese, (former CLAD, future CLD)

Some people call me the Space Cowboy!
Some call me the gangster of love.
Some people call me MoReese!
...I'm right here baby, right here, right here, right here at home
Message 19 of 26
(1,299 Views)

Thanks.. I figured it out...

though I have some problem with using the event structure to call the blocks, but that's a separate issue 🙂

0 Kudos
Message 20 of 26
(1,270 Views)