LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Initializing string array registers

Solved!
Go to solution

Hello. I have posted my project. It is not even close to finished but I am having trouble initializing the array's labeled "Up values" and "Down values", to "0" for all elements, at beginning of Vi run. So, when I am at the Front Panel and running the Vi, I would like all of the fields to begin with a "0", the moment the Vi is started. I have tried a couple different things I could think of and watched the Core 1 Video about arrays again however, it doesn't give the example for a string and nothing I have tried so far, is working. Thank you.

0 Kudos
Message 1 of 7
(3,670 Views)

There are a few options to you:

1. Use an initialization state to write to your indicators their default values via a local variable

2. Put the default values into the indicators and then right-click on them and choose Data Operations->Make Current Value Default.  This will store the default value in the indicators themselves.

 

I would recommend going with #1.


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
Message 2 of 7
(3,662 Views)

@crossrulz wrote:

There are a few options to you:

1. Use an initialization state to write to your indicators their default values via a local variable

2. Put the default values into the indicators and then right-click on them and choose Data Operations->Make Current Value Default.  This will store the default value in the indicators themselves.

 

I would recommend going with #1.


2. Put the default values into the indicators and then right-click on them and choose Data Operations->Make Current Value Default.  This will store the default value in the indicators themselves. I put a "0" in each field, I slected "make current value default, but after the Vi ran, and then I started the Vi again, it keeps the numbers in the registers that are left over from the previous test. I also tried your suggestion #1. however, it still isn't writing a "0" in all the fields. The reason for this is that I don't want the operator's to read old data accidentally, when the Vi is running. I thought if I wipe all the registers out, it will prevent that from happening.

0 Kudos
Message 3 of 7
(3,644 Views)

ceilingwalker wrote:  I put a "0" in each field, I slected "make current value default, but after the Vi ran, and then I started the Vi again, it keeps the numbers in the registers that are left over from the previous test.

That's why I said I recommended #1.

 


ceilingwalker wrote: I also tried your suggestion #1. however, it still isn't writing a "0" in all the fields.

Please show your code for this.  I suspect you missed something.


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
Message 4 of 7
(3,635 Views)

@crossrulz wrote:

ceilingwalker wrote:  I put a "0" in each field, I slected "make current value default, but after the Vi ran, and then I started the Vi again, it keeps the numbers in the registers that are left over from the previous test.

That's why I said I recommended #1.

 


ceilingwalker wrote: I also tried your suggestion #1. however, it still isn't writing a "0" in all the fields.

Please show your code for this.  I suspect you missed something.


Please show your code for this.  I suspect you missed something. I think I see what you mean. I was trying to do this on the "Test in progress" state. I needed to create an entire new state and call it initialization, correct? I think that was my error and am trying it now.

0 Kudos
Message 5 of 7
(3,628 Views)
Solution
Accepted by topic author ceilingwalker

Populating indicators with default values is not very useful, because they will get overwritten once the program runs and the indicators get updated. Typically, default values are much more useful for controls.

 

In any case, if you want indicators to reset to the default values whenever the VI is run, go to "VI properties...execution" and check "clear indicators when called".

 

See if this solves your perceived problem. Good luck!

 

Message 6 of 7
(3,615 Views)

Thank you both for your support. It does exactly what I was hoping for.

0 Kudos
Message 7 of 7
(3,609 Views)