LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Eval Multi-var Scalar 80 variables

Hello, first post on this board... using LabView 8.2.1 and I'm creating an interface that lets you enter in an equation to evaluate. The problem is, I need variables c0 to c79, (80 variables). LabView's Eval multi var scalar vi doesn't let you do variables named "c10" and such. Right now I've setup a0 to a9, all the way to h0-h9.

I guess my question is, does anyone know a way to accomplish this? I'm right now in the middle of wiring up a conversion VI to convert c0-c79 to the appropriate variable name (a0-h9) using Search and Replace Pattern (although I cannot come up with an easy way to do this)

Thanks.
0 Kudos
Message 1 of 7
(3,880 Views)
It looks like the problem lies deep within one of the (many) subVIs. It seems to start with the "Bracket Balancing" subVI. One thing is for sure. The documentation for the function has this:

Eval Multi-Variable Scalar Details

The VI calculates the function using the following equation.

y = f(x1, x2, …, xn)

It does not say that n is limited to 9. So, either the documentation is missing this little "detail", or the code is wrong.

As to your question about replacing: there's a few ways you can do this. Here's one way:





Message Edited by smercurio_fc on 07-11-2008 11:01 AM
Download All
0 Kudos
Message 2 of 7
(3,860 Views)
wow you are the man.
 
thanks bro 🙂
0 Kudos
Message 3 of 7
(3,855 Views)
your code works, but if i entered c5+c44, it would result in "a5+a44"
 
 
the logic i was going for is:
 
for loop 0-79 (N)
       next = string compiled from
(1) a looping variable index 0-8 (when it hits 8 it goes back to 0) that pulls a string from an array 0-8 corresponding to a-h
(2) a looping variable index2 that goes from 0-9
  
       replace from input string ( "chN", next)
end loop


Message Edited by bkb on 07-11-2008 11:31 AM

Message Edited by bkb on 07-11-2008 11:35 AM

Message Edited by bkb on 07-11-2008 11:38 AM
0 Kudos
Message 4 of 7
(3,847 Views)
array = 8 element array holding characters a to h
 
For x = 0 to 7
       For z = 0 to 9
                chan = "ch" + (x*10) + Z
                new = buildstring(pickfromarray(array, x), Z)
                searchandreplace(formula, chan, new)
       end
end
 
i love psuedocode
 
0 Kudos
Message 5 of 7
(3,835 Views)
Well, you can certainly use 2 loops. As I said, there's a variety of ways to do this. For instance, you can count backwards while using a single loop:
0 Kudos
Message 6 of 7
(3,822 Views)

ok, got it working. thanks for your help

 

i attached the VI picture

 

(note) toggle the False constant to True otherwise it only replaces 1 instance



Message Edited by bkb on 07-11-2008 02:03 PM
0 Kudos
Message 7 of 7
(3,814 Views)