08-10-2013 08:08 AM
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).
08-10-2013 09:36 AM
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?
08-10-2013 10:18 AM
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...
08-13-2013 09:25 AM
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.
08-13-2013 09:34 AM
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
08-13-2013 09:35 AM
tnx for ur exelent comment.altenbach
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.