LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

from string to block diagram

Hi,

 

I need to know how you can translate a string, a formula, to the block diagram. So for instance, if you have G=5+3*lnW, how can you translate the ln to the ln in the block diagram. The formula isn't fixed so I can't make a hard code.

 

Thanks in advance

 

KF_ 

0 Kudos
Message 1 of 8
(3,552 Views)

edit: oops didn't see that the formula always changes

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 2 of 8
(3,547 Views)

The goal is that I can give in the formula in the front panel, not in the block diagram like the formula node

0 Kudos
Message 3 of 8
(3,540 Views)

Check this out, my friend:

 

http://zone.ni.com/reference/en-XX/help/371361G-01/gmath/advanced_formula_vis/

 

Smiley Happy

http://www.medicollector.com
Message 4 of 8
(3,535 Views)

That's great - I just learned something new!

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 5 of 8
(3,530 Views)

You would need to write a parser that would evaluate the equation entered. If you use RPN this is fairly easy to do. RPN is nice since it lends itself well to using a stack for processing the equation and you will always be dealing no more than the top two elements of the stack. Your evaluation routine would be in a loop that would parse the equation and invoke the proper case in a simple state machine. You will need to use a shift register to store the variables, operations and intermediate results as you parse the equation. You would need a case for each operation you will support.



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
0 Kudos
Message 6 of 8
(3,529 Views)

Ok, these comments should help me enough, cheers

0 Kudos
Message 7 of 8
(3,517 Views)

Is Python an option?  Look at this example I posted (a few years ago - wow) using LabPython.

 

Jim
You're entirely bonkers. But I'll tell you a secret. All the best people are. ~ Alice
For he does not know what will happen; So who can tell him when it will occur? Eccl. 8:7

0 Kudos
Message 8 of 8
(3,484 Views)