LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Vector formula

Hi All,

I have a question - is it possible to use vector formulas i LabView? I mean to execute vector formula wroten in front panel? for example if I put x=0 - it will replace all values from array named x by zeros, or x(20) = 10 - it will replace value indexed 20 in array x by 10, or x(10:100) will show values from range 10 to 100 from array x, or y(1) = x(2) will replace first values from array y by second element from array x.

Is it possible? if yes - how?

 

Regards

Mike

0 Kudos
Message 1 of 7
(1,747 Views)

Mike,

 

You could do all of those things.  Some would be rather straightforward while others might be more challenging.

 

Are you planning to use native LV controls and indicators or do your want to use a string control and parse out what the user types?  If you are going to parse strings, do you have a very complete and comprehensive specification document which defines every allowable function?

 

What are you really trying to accomplish? I suspect that a much easier way, taking advantage of the LV graphical user interface and dataflow may exist.

 

Lynn

0 Kudos
Message 2 of 7
(1,739 Views)

I know that's easier but then I won't have so many options. When using formula string I can change math operation immediately, I can choose what I want to do and that's great but it's not enough for me:) for example you have 2 arrays, both of 1000 elements, and u want to do operation like this: a3=a1+a2*30+cos(a1) etc, but after that you just want to see a part of it for example elements from 300 to 500 so you put a3=a3(300:500). Or one of this arrays contain elements that u don't want and u want to replace them by others so: a1(2:5)=0.

I tried to use something like that in formula node and it works but I can't modify formula node when programm is running.

It would be great to have something like formula node in front panel... - eval formula node isn't the same I tried to use it but it won't work as I wanted:(

0 Kudos
Message 3 of 7
(1,737 Views)

I am still not sure exactly what you are trying to do.

 

It looks as though you will need to write your own parser to get the flexibility you want.  That may be a rather complex task.  Depending on how many options and functions you include, it could be rather slow to execute.

 

Good luck.

 

Lynn

0 Kudos
Message 4 of 7
(1,731 Views)

So there's no way to simply use symbols in eval formula node/string that u can use in formula node?

0 Kudos
Message 5 of 7
(1,728 Views)

I have never used that function.  You can look at the help files and try some things to see what it can do.

 

Lynn

0 Kudos
Message 6 of 7
(1,724 Views)

Actually, you have some options to create a formula (string) on the front panel and use evaluate the equation.

 

The first is using the formula string functions. They are located at Mathematics >> Scripts & Formulas >> 1D and 2D Evaluation. There, you can find several functions that use strings to hold the formulas and you can use the Eval Single-Variable Scalar to evaluate the equation. This is a very powerful and should be able to help you do what you what.

 

The second option is to use the LV Mathscript RT Module and use the eval command. The command allows to evaluate the script formula inside the node and give the result back. For more information, open LabVIEW help and search for this command.

 

Hope this helps

Barp - Control, Simulation, RTT and HIL - National Instruments
0 Kudos
Message 7 of 7
(1,708 Views)