LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

saving values in an array

Hello,

 

In this program you have to calculate the gravity force, everytime you press 'calculate' the number had to be autoùmatically stored in an array. The array has to contain all previous values.

Can anyone help me please?

Regards

0 Kudos
Message 1 of 6
(4,343 Views)

I recommend an Event Structure inside of a While Loop.  You can then store the array in a Shift Register and use Build Array to add items to it.  See how far you get with that information.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 2 of 6
(4,335 Views)

... and next time you attach a VI, give a reasonable name. Calling it "Untitled 1.vi" causes problems and is just plain lazy. For example my downloads folder already has over 10 VIs with that name, meaning the browser will append a number and thus change the name, making it diffuclt to find later.

Also please don't maximize the block diagram to the screen. That's very annoying.

 

Back to your code:

  • Yes, follow Tim's suggestions above.
  • If this is a school assignement, I am sure the relevant topics have been covered and you should have no problem with the suggestions.
  • Also try to find the most appropriate mechanical action for the button, "switch when pressed" is probably not right for this.

 

 

 

 

0 Kudos
Message 3 of 6
(4,297 Views)

Kindly Try to explore your LabVIEW. go to,  Help>>Find Examples.

 

 



Thank you & Best regards
syrpimp

=======================================================
“You must continue to gain expertise, but avoid thinking like an expert." -Denis Waitley
0 Kudos
Message 4 of 6
(4,282 Views)

Thank you for your response,

We were told we couldn't use event structures...
However i think i almost found how to do it, there is just one strange thing:
if our index is zero, the number that has to be written in our array get written in all elements, when the index is one the value is written in all elements exept were index is zero and so one.
How do I fix this so when the index is zero it ONLY gets written in the element with index zero .

 

Thanks in advance

0 Kudos
Message 5 of 6
(4,229 Views)

@Lodde wrote:

We were told we couldn't use event structures...


I HATE it when teachers tell people to not use good programming practices...

 

Learn to use Shift Registers.  They will make your code A LOT easier to work with and eliminate  the race conditions that you have in your code.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 6 of 6
(4,224 Views)