05-22-2011 11:34 AM - edited 05-22-2011 11:43 AM
I tried to use mathscript to evalute something specified in front panel, so I've fount evalscript, but after I've connected everything I've received something that I didn't expected;/ Can anyone tell me what's wrong?
05-22-2011 02:35 PM - edited 05-22-2011 02:53 PM
It would be so much easier for us to troubleshoot if you could attach the actual VI instead of a picture. Make sure it contains useful default data in the controls.
...g I've received something that I didn't expected;/ Can anyone tell me what's wrong?
Now we know what you did not expect, but we still don't know what you actually expected. That might be useful to know too.
Why do you think that a 2D complex array is the correct representation for the output? Define it as a string output instead and make the string indicator big enough (horizontally and vertically) to show all characters. Better?
05-22-2011 02:55 PM
Ok I've fixed some errors and it works quite well but it's really slow... but it's not the point, I can use formulas like this: c1(1:3) but I can't replace it;/ I tried to put more output (c1 as input and output) and tried c1(1:3)=1 or add in node:
c3 = eval(formula) c1=eval(formula)
or change it to eval(formula) and put in formula c3=....
but it won't work
What I'm expecting? good working program Seriously - to work with formulas (from front panel) that you can use in formula node or mathscript in block diagram. I want to use formulas like these:
Yes, I know - it's complicated;/
05-25-2011 02:34 AM
Thanks for the extra details!
Yes, the Mathscript node is expected to run a lot slower when there is an exclamation mark inside. Please read this page for details - Slow performance of MathScript Node, or just use the context help.
Since you want to use formulas from front panel, that the user types, without checking for correct spelling, you will continue to have this issue.
All the formulas you gave as example work with evalscript, and also if you just type them in the node, except for the 3rd one, where it is not clear what multiplication you expect. In the VI I attached, it is replaced with .* to multiply each element one by one. If you would like matrix multiplication, you need to use the transpose of one of the 2 arrays.
Anyway, from the timing benchmarks on my computer, the execution lasts only about half of a second.
If you need to grow your application and need faster execution time for more complex formulas, you should really consider checking for correctnes of formula before passing it to Mathscript node.
Let us know if you have more questions!