LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Newby question

How do you initialise values to a control array? I want to set all the
values to zero, say, before the program runs.

Thanks
0 Kudos
Message 1 of 7
(2,985 Views)
Hi,
there are 2 solutions:
1. If you want to initialize your array with some data at the beggining of the program you must use "Finctions->Array->Initialize Array.vi" to fill array with some data. The only thing is that in thic case you will probably need to use local variable of your array.
You can read help about it.

2. If you want your array to be filled with some data every time when you open your VI you must fill the array somehow, right-click on it and select "Data Operations->Make current value default" from pop-up menu. Then you must save the VI and it will have those default values every time you open it.

Example is attached.
This example does the next things:
1. initializes graph with zeroes and waits till the start button will be pressed.
2.
when start button pressed this vi updates graph with some noisy data.

Good luck.

Oleg Chutko.
0 Kudos
Message 2 of 7
(2,985 Views)
Hi !
- Type your default value in each element of the array (example 0).
- Then rightclick on each element in the array and select "Save current
value as default value"
This will work


Regards

Magnus
"John Ennew" skrev i meddelandet
news:b03t68$4ak$1@wisteria.csv.warwick.ac.uk...
> How do you initialise values to a control array? I want to set all the
> values to zero, say, before the program runs.
>
> Thanks
>
>
0 Kudos
Message 3 of 7
(2,985 Views)
Thanks.

What if I want to load all the values from a spreadsheet file into a control
array. Is that possible?

"Magnus Johnson" wrote in message
news:npgV9.6360$LY2.376166@newsc.telia.net...
> Hi !
> - Type your default value in each element of the array (example 0).
> - Then rightclick on each element in the array and select "Save current
> value as default value"
> This will work
>
>
> Regards
>
> Magnus
> "John Ennew" skrev i meddelandet
> news:b03t68$4ak$1@wisteria.csv.warwick.ac.uk...
> > How do you initialise values to a control array? I want to set all the
> > values to zero, say, before the program runs.
> >
> > Thanks
> >
> >
>
>
0 Kudos
Message 4 of 7
(2,985 Views)
John,

Sure. If the reading of the file is the first thing done in your program, then this will be an easy task. That is how LabVIEW loads. It stores a bunch of options in the LabVIEW.ini file. When LabVIEW first launches, it parses this file ans starts LabVIEW with the correct options. You would be doing something very similar.
Also, the way you are aproaching this is exactly what you would need to do if you build your VI into an executable. See this as an example.

Randy Hsokin
Applications Engineer
National Instruments
http://www.ni.com/ask
0 Kudos
Message 5 of 7
(2,985 Views)
Thats all great guys! Thanks a lot....

Just one last question... is it possible to update values held in a control
array whilst a program is executing (other than manually!!), by loading them
from a spreadsheet file?

Cheers for any advice (As you see, I'm quite new to all this!)

"Randy H" wrote in message
news:506500000005000000FEC40000-1042324653000@exchange.ni.com...
> John,
>
> Sure. If the reading of the file is the first thing done in your
> program, then this will be an easy task. That is how LabVIEW loads. It
> stores a bunch of options in the LabVIEW.ini file. When LabVIEW first
> launches, it parses this file ans starts LabVIEW with the correct
> options. You would be doing something very similar.
> Also, the way
you are aproaching this is exactly what you would need
> to do if you build your VI into an executable. See
>
href="http://pong.ni.com/public.nsf/websearch/BCFF7D3335E256E286256509006772
3D?OpenDocument">this

> as an example.
>
> Randy Hsokin
> Applications Engineer
> National Instruments
> http://www.ni.com/ask
0 Kudos
Message 6 of 7
(2,985 Views)
Sure, this can be done. You can just read in the file and parse the data out that you want. Then, wire this data to the indicator terminal or to a local variable for the control.

Randy Hoskin
Applications Engineer
National Instruments
http://www.ni.com/ask
0 Kudos
Message 7 of 7
(2,985 Views)