12-04-2017 09:43 AM
I have a formula node which gives me an error called.Error on line 1 is marked by a '#' character: "constant#=(Pi*f/c) Einsta=constant*sqrt("
I created a constant, but i gives me an error. wham I doing wrong?
Solved! Go to Solution.
12-04-2017 10:00 AM - edited 12-04-2017 10:02 AM
It would be easier to help if you would attach a simplified version of the VI instead of a picture.
My first guess is that "pi" is a reserved word. (You don't need to define it and wire pi to the terminal.) Check the help. There might be other problems, but I don't typically debug images. Where do you define "constant"?
12-04-2017 10:51 AM
The formulas are all the same except for the input value. So why not bundle the inputs into an array (using Labview primitives of course), auto-index the array for each input and calculate the output. Throw all of this into a subVI and get rid of that formula node.
12-04-2017 10:59 AM - edited 12-04-2017 11:01 AM
12-04-2017 11:11 AM
@GerdW wrote:
Edit:
@aputman: What's the purpose of the FOR loop?
Yeah you're right. I forget that the primitives can operate on arrays.
12-04-2017 11:17 AM - edited 12-04-2017 11:18 AM
@aputman wrote:
The formulas are all the same except for the input value. So why not bundle the inputs into an array (using Labview primitives of course), auto-index the array for each input and calculate the output. Throw all of this into a subVI and get rid of that formula node.
As GerdW stated, no FOR loop required.
12-04-2017 12:20 PM
As others have said, try to use LV primitives, if possible. The less typing a human has to do, the better. 😉
12-04-2017 12:59 PM
While I agree with everyone saying use the primitives over the formula node, the reason you are getting an error is because constant is undefined. Add constant as an output if you want it to work the way you have it set up
12-04-2017 01:27 PM
@OEM_Dev wrote:
Add constant as an output if you want it to work the way you have it set up
Or just declare it before that line.
float constant; constant=pi*f/c; Einsta=constant*sqrt(480*(Pinsta./G)); Eavg=constant*sqrt(480*(Pavg./G)); Epeak=constant*sqrt(480*(Ppeak./G));
12-04-2017 10:53 PM
@OEM_Dev wrote:
While I agree with everyone saying use the primitives over the formula node, the reason you are getting an error is because constant is undefined. Add constant as an output if you want it to work the way you have it set up
And the root cause? Typing. I have to admit that I have this bias against typing because I so thoroughly SUCK at it. 😉