|
From: DonRoth on 7 May 2008 09:40 Hi Folks - I am testing out the ability of 'Substitute Variables.vi' and 'Eval Single-Variable Scalar.vi' in a very simple VI but I am getting a 'Bracket Problem at the end' error coming out of the latter. I thought I had the syntax on this basic formula correct. I have 5 left parantheses and 5 right paranthases. I use the ln(x) and exp(x) functions and several math operators including ** for exponentiation. The string is: a1*exp((-4*ln(2))*((x-m1)/w1)**2) where x, a1, m1, and w1 are variables and x is the variable that will be evaluated in 'Eval Single-Variable Scalar.vi'I am using the 'Substitute Variables.vi' to actually substitute constants for variables a1, m1, and w1.It is concievable that the indicated error is pointing to something else that is incorrect.Any help is appreciated.Sincerely,Don test11.vi: http://forums.ni.com/attachments/ni/170/321707/1/test11.vi
From: altenbach on 7 May 2008 12:10 Use "^" for exponentiation instead of "**". See the online help for differences in syntax (image) <img src="http://forums.ni.com/attachments/ni/170/321792/1/mathformula.png"> Message Edited by altenbach on 05-07-2008 08:49 AM mathformula.png: http://forums.ni.com/attachments/ni/170/321792/1/mathformula.png
From: johnsold on 7 May 2008 13:10 An unrelated issue: The constant arrays which autoindex into the for loop are of different lengths. The one with "6" has only one element, so the only one iteration of the for loop occurs. Lynn
From: DonRoth on 7 May 2008 13:40 Yes - it works now so I am attaching again a simplied example for others to use to see how these functions can work together. I knew there were some differences in the formula syntax rules but I did not see that table before. Thanks, Don test1_working.vi: http://forums.ni.com/attachments/ni/170/321854/1/test1_working.vi
From: altenbach on 7 May 2008 14:10 Also remember that you should use the "array version" instead of a FOR loop of you need to calcualte it for multiple inputs. This saves on the expensive parsing. See the online help. For example your original example (corrected) would look like the attached. test11MOD.vi: http://forums.ni.com/attachments/ni/170/321875/1/test11MOD.vi
|
Pages: 1 Prev: Memory deallocation Next: Best way to scan an array from a text file |