LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Mathematical Expression Evaluator [Parser]

Hi,

Is there some way in which a user enters some text in the string box
at the user interface, so that LabWindows/CVI evaluates this string?

For example, the user enters the text "(a+b*200)/63" as a string at
the user interface, so that the result of this expression is stored in
some variable.

I understand this involves parsing, but I am not too proficient at it.
If anyone can help me out in this, I would really appreciate it.

Thanks and regards,
Arvind Prasad.
0 Kudos
Message 1 of 9
(3,795 Views)
"Arvind" wrote in message
news:d0d35dd7.0403021500.64bd569f@posting.google.com...
> Hi,
>
> Is there some way in which a user enters some text in the string box
> at the user interface, so that LabWindows/CVI evaluates this string?
>
> For example, the user enters the text "(a+b*200)/63" as a string at
> the user interface, so that the result of this expression is stored in
> some variable.
>
> I understand this involves parsing, but I am not too proficient at it.
> If anyone can help me out in this, I would really appreciate it.


This simple goal may take longer that what most might expect. I refer you to
a topic "4.3 External Variables" on page 73 from the K & R, second edition.
The topic gives code for a calculator using reverse polish nota
tion.

****************
Mohan Pawar

>
> Thanks and regards,
> Arvind Prasad.
0 Kudos
Message 2 of 9
(3,795 Views)
The attached code allows evaluation of expressions in X, Y and T. You first supply the expression as a string to Convert(), then you can use Evaluate() to calculate the results for given X,Y,T values.

HTH,
Martin.
--
Martin
Certified CVI Developer
0 Kudos
Message 3 of 9
(3,795 Views)
In message , Arvind
writes
>Hi,
>
>Is there some way in which a user enters some text in the string box
>at the user interface, so that LabWindows/CVI evaluates this string?
>
>For example, the user enters the text "(a+b*200)/63" as a string at
>the user interface, so that the result of this expression is stored in
>some variable.
>
>I understand this involves parsing, but I am not too proficient at it.
>If anyone can help me out in this, I would really appreciate it.
>
>Thanks and regards,
>Arvind Prasad.

You should be able to find quite a number of algorithms written in C at
this site www.programmersheaven.com

You'll have to adapt them to work with CVI but it shouldn't bee too
hard.
--
Reg
ards,

John Cameron.
Type softly, read gently.
Message 4 of 9
(3,795 Views)
Hi Arvind,
I have no ideas what are labwindows and cvi but you can try Cioina.dll from
http://www.geocities.com/alexei_cioina/cioinaeval.html

Best regards.
Alexei.


arvind@cae.wisc.edu (Arvind) wrote in message news:...
> Hi,
>
> Is there some way in which a user enters some text in the string box
> at the user interface, so that LabWindows/CVI evaluates this string?
>
> For example, the user enters the text "(a+b*200)/63" as a string at
> the user interface, so that the result of this expression is stored in
> some variable.
>
> I understand this involves parsing, but I am not too proficient at it.
> If anyone can help me out in this, I would really appreciate it.
>
> Thanks and regards,
> Arvind Prasad.

0 Kudos
Message 5 of 9
(3,795 Views)
Hi Mohan,
Thanks for the reply. I will surely look through the article u have suggested.
Thanks for ur time,
Arvind.
0 Kudos
Message 6 of 9
(3,795 Views)
Dear Martin,
Thanks for the code supplied! I will try and implement it into my application and will surely include a credit line for u!
TSH [That sure helped!]
Thanks for ur time,
Arvind.
0 Kudos
Message 7 of 9
(3,795 Views)
Dear John,
That was an awesome link, I found "EXACTLY" what I wanted!
Thank you very much,
Arvind.
0 Kudos
Message 8 of 9
(3,795 Views)
Dear Alexei,
Thanks for replying. I haven't yet tried out the dll since I might have fnd an alternative. But thanks for replying and I will get back to you if I use the dll.
Regards,
Arvind.
0 Kudos
Message 9 of 9
(3,795 Views)