alphaone Posted September 27, 2005 Report Share Posted September 27, 2005 Hi everybody, as we all know, Labview is a data-flow programming language,everything must "flow in" from left and "flow out" to the right. I can't convert this programming style from general language. Here is an example that add 1 to itself. in C. the code is :number += 1; in lv,it looks like the following picture. I feel it's so bad, but I have no other way. Somebody can bring me a new idea?? Thanks. Quote Link to comment
Michael Aivaliotis Posted September 27, 2005 Report Share Posted September 27, 2005 try this. Quote Link to comment
Jeffrey Habets Posted September 27, 2005 Report Share Posted September 27, 2005 Hi everybody, as we all know, Labview is a data-flow programming language,everything must "flow in" from left and "flow out" to the right. I can't convert this programming style from general language. Here is an example that add 1 to itself.in C. the code is :number += 1; in lv,it looks like the following picture. I feel it's so bad, but I have no other way. Somebody can bring me a new idea?? Thanks. The C notation number += 1; basically is short notation for number = number + 1; So the LV diagram is not that different from C here. The diagram you posted can be simpler. Loose the sequence, it's not necessary (dataflow). Also, you can get rid of one local in this particular example. Whether or not you need the second local havily depends on the context in which you would be doing this operation. Most of the time you will be operating on data in shift registers or results from sub-vi's and displaying those in an indicator. No locals needed there. Learning moment: stop thinking in variables, the 'variable' is the wire!! Quote Link to comment
alphaone Posted September 27, 2005 Author Report Share Posted September 27, 2005 Thank Michael and jeffreyhabets. I think what confused me is how to convert the conventional progromming methodology to the LV's. Sometimes I found it's so urgly and reduntent if I change a value of an array by using "Replace Array Subset" that input an array by value and must connect output to an other array. So ,just like this simple example ,i have to use 2 locals. Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.