LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Formula node problem

I have revorked my code using only LV but the Value after probe 14  is not getting updated for some reason. Even though my debugging showed that the probe 14 shows correct values. I am not using any tunnels. Any idea where my mistake is?

Thanks.

0 Kudos
Message 11 of 19
(1,900 Views)
You're using Replace Array Subset. You can't replace an element if it doesn't exist. To add columns you need to use Build Array, as my example showed.

Also, you're still in a C-mindset. You do not need the "Value" property node at all. You can use auto-indexing as I showed you in my simple example, and then wire the output of the array directly to the terminal.
0 Kudos
Message 12 of 19
(1,896 Views)
Well, It is always best to do things "in place". You know the final table size from the beginning (e.g. from the number of headers).
All you need to do is initialize a string array of that size and the populate it with your data.
 
Here's a quick modification.
 
I also believe that your table should be an indicator, because it is populated programmatically. Your overuse of property nodes
looses the distinction between indicator and control.
 
Modify as needed. Let me know if you have any questions or concerns.
 
 


Message Edited by altenbach on 05-27-2008 04:27 PM
Download All
0 Kudos
Message 13 of 19
(1,884 Views)
Thanks a lot for your response . I finally got it. I had a problem with missing columns like you said. OMG, I've spent 8 hours on this piece of code! In C it would have taken me like 10-15minutes.  I have attached my final version.

0 Kudos
Message 14 of 19
(1,874 Views)


RSibagatullin wrote:
OMG, I've spent 8 hours on this piece of code! In C it would have taken me like 10-15minutes.

Well, it only took me 4 minutes in LabVIEW. 😄
 
You should REALLY use my method and get rid of these value property nodes. They are so inefficient that it takes noticeable time to fill the table. Each value property node is syncronous and you have two per inner loop!
 
My code is instantaneous by comparison. Try it!
0 Kudos
Message 15 of 19
(1,870 Views)
wow, indeed your code is fast! In berkeley it is end of working day. So I will go over your code at home. Thanks.
0 Kudos
Message 16 of 19
(1,869 Views)
Could you comment on the use of the shift registers in your program? I get sort of confused about them since I started  learning LV just recently.

0 Kudos
Message 17 of 19
(1,837 Views)
Shift registers are used to carry around transfer (better word) a value from one iteration to the next. The LabVIEW Help has a section on shift registers.

To learn more about LabVIEW it is recommended that you go through the tutorial(s) and look over the material in the NI Developer Zone's Learning Center which provides links to other materials and other tutorials. You can also take the online courses for free.


Message Edited by smercurio_fc on 05-28-2008 11:00 AM
0 Kudos
Message 18 of 19
(1,832 Views)
Understanding shift registers is a core LabVIEW skill. They are one of the most powerful features in LabVIEW. 🙂
 
You can think of the entire connected set of shift registers in this example as one single memory location that contains the string array.
In the inner loop you read elements from it and then replace the data in other elements. As long as the array size does not change
(and it does NOT the way I designed it), all operations are performed "in place" in memory (well, this is completely true in cases of
numeric arrays, strings are handled a little bit differently).
 
Updating a value via a property node is synchronous and this very expensive. Basically, The code needs to drop everything it is doing,
switch to the UI thread, update the control or indicator (in this case a complicated table!), switch back to the original thread, and continue
with the diagram code.
 
See the following discussion and also the link in it.
 
 
Since you are coming from a C background, you still seem to be stuck in a mindset that needs "variables". In LabVIEW, the wire is the variable
and things are much more efficient if you don't constantly punch to the user interface.
 
 
OK, here you have some easy reading. Once you grasp the key concepts of dataflow programming, you'll be blown away by its simplicity and efficiency. 😄
 


Message Edited by altenbach on 05-28-2008 09:21 AM
0 Kudos
Message 19 of 19
(1,824 Views)