LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Initialize

Hello. I'm new in LabView. I want to know if there is any structure, command or function that can initialize data and another thing in the first iteration of the VI running? As an illustration we want to allocate value 5 to variable "X" and restart all datas remained in the buffer (set them 0).

0 Kudos
Message 1 of 6
(2,690 Views)

 

 

  • On typical ways is the "first call?" primitive. Wire it to a case selector terminal and place the initialization code inside the true case.
  • Sometimes it is sufficient to place the initialization code to the left of the main loop.
  • Sometimes you would create a init state in a state machine.

How do you later hold the data that is initialized?

Can you show us some code so we get a better idea what you are trying to do?

0 Kudos
Message 2 of 6
(2,676 Views)

In addition to Christian's excellent comments, there's one more thing to consider. If you are looking at your problem in terms of, "I have a variable "X" that I need to initialize." you may be thinking about the problem wrong.

 

For the most part, LV doesn't have named variables, instead LV has wires. Named variables are important in languages (C, Java, BASIC, etc.) because in those languages the operations that control the logical flow through the program are the things that give the programs their structure. In this situation, the data that the code is processing is a secondary matter.

 

By contrast, LV is a graphical dataflow language, or to say it in another way:; with LV it is all about the data. In a properly written LV program, it is the data, not the logical control operations, that give the program its structure. With LV you should be thinking about your code in terms of, "OK, I have these inputs and I need these outputs. What do I need to do to transform the inputs into the outputs?" In the process of answering that question you will, of course, encounter the need to make decisions or selections, or loop through things some number of times. But these logical control operation aren't, or shouldn't be, your primary focus. In LV, therefore, a loop isn't something that gives a program structure, it's a means of actualizing data transformation.

 

Or at least that's my Saturday-morning take on the whole process.

 

Mike...


Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
Message 3 of 6
(2,672 Views)

tnx for ur exelent comment.

My question is completely a general question. I want to allocate some value just in the first iteration of compiling the program. Your first suggestion suffices for the present my purpose.

0 Kudos
Message 4 of 6
(2,614 Views)

Thx Mike for your thorough answer.

I'm new in LabView so i was looking to LabView in a view same as other conventional languages.

ur comments was informative and complete.

tnx

Vahab

0 Kudos
Message 5 of 6
(2,608 Views)

tnx for ur exelent comment.

My question is completely a general question. I want to allocate some value just in the first iteration of compiling the program. Your first suggestion suffices for the present my purpose.

0 Kudos
Message 6 of 6
(2,606 Views)