LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Storing numeric outputs from an element in a 1D array

Solved!
Go to solution

Hello all,

 

This must be simple and easy, but I don't seem to get it. A sample VI is attached.

 

I have a slider control onto which I do some manipulation to generate a numeric element output. I can keep on sliding and get the generated outputs, but now I need to store all those possible outputs in a 1D array. 

 

Your help will be much appreciated.

 

Regards

0 Kudos
Message 1 of 13
(3,463 Views)
Solution
Accepted by topic author nskatlv

Yes reasonably simple and easy.  You missed a few basics on LabVIEW. see the attached note in the modified VI.

(Also presented as snippette for those not caring to DL Attachment

!0.png

 


"Should be" isn't "Is" -Jay
Message 2 of 13
(3,449 Views)

Thanks Jeff,

 

I was also trying the shift-register at my end, but with a 'for loop'. Didn't work.

 

Just for understanding, is the loop suspension done to first have the initialized array in the buffer ? Or it serves additional purpose too.

 

Regards

0 Kudos
Message 3 of 13
(3,444 Views)

Do a quick search on the term "Greedy Loop."  The link will take you to many discussions that can explain why some delay is desireable.


"Should be" isn't "Is" -Jay
0 Kudos
Message 4 of 13
(3,441 Views)

nskatlv wrote:

Just for understanding, is the loop suspension done to first have the initialized array in the buffer ? Or it serves additional purpose too.


The wait forces the loop to wait 10ms before going to the next iteration. This is still way too generous, because there is no way you can operate the control that fast. Ideally you should use an event structure so the loop only spins when a new value is entered. It is really not very useful to overwrite the same value 100x per second if nothing changes.

 

A loop without any wait at all is called a greedy loop. It spins as fast as the computer allows (millions of times per second), using 100% of a CPU core, and starving all other processes and programs on your computer that also want a slice of the pie. It is only useful in winter if your heater is broken and you want to run your computer as hot as possible. 😄

 

 

(from here)

Message 5 of 13
(3,436 Views)

Lol, I get it altenbach.

 

From the search term Jeff shared, I had already stumbled upon this toon of yours. Will never forget it now. 🙂

 

Although the problem as I stated stands solved, it turns out it might not be easy (or so it seems) to implement it in my actual big diagram. Because there are many a sliders and then scripts etc running to finally yield that output numeric indicator I need to store the values of.

 

Is there another solution (may be using event structure), which sees 'only' the output indicator and stores it's values as they change.

 

Regards

 

 

0 Kudos
Message 6 of 13
(3,430 Views)

nskatlv wrote:

Is there another solution (may be using event structure), which sees 'only' the output indicator and stores it's values as they change. 


What is your definition of "see"?

0 Kudos
Message 7 of 13
(3,421 Views)

I mean a code that only envelops the output indicator, and not the slew of code behind it that makes it's values change.

 

I just created a version using Event Structure, but it needs the rest of code in the structure. Attached.

 

Regards

0 Kudos
Message 8 of 13
(3,418 Views)

@nskatlv wrote:

I mean a code that only envelops the output indicator, and not the slew of code behind it that makes it's values change.

 

I just created a version using Event Structure, but it needs the rest of code in the structure. Attached.

 

Regards


Thanks for coming back to the topic.

 

YES, I would be using an event structure to capture user activity on the front panel.  I did not want to go past the few larger problems untill you understood them.  Go ahead and try something new.  Check the help file.  Post another thread when you get stuck or want a specific piece of advice.


"Should be" isn't "Is" -Jay
0 Kudos
Message 9 of 13
(3,409 Views)

Thanks Jeff,

 

The point where I am stuck is that in the latest code I attached (with Event Structure), is it possible to modify it so that only the indicator (Y=x*5) is taken inside the structure and while-loop. While the rest of stuff (sliders and calculators here) remain outside.

 

I say this because in my actual code, the input sliders and the calculating code is big and scattered, and am afraid of messing it up while trying to put certain things inside structure and the loop.

 

Regards

0 Kudos
Message 10 of 13
(3,405 Views)