ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

LabVIEW MathScript RT Module

cancel
Showing results for 
Search instead for 
Did you mean: 

Variable Substitution in MathScript

Hi,

how is it possible in MathSkript to substitute a variable with the actual value in an expression?
To be more specific, I want to do in principle the following:

% this works
f='x+y'
ezsurf(f)

% then I want to multiply y by a factor
scale=100
f='x+y*scale'
ezsurf(f)
% which then fails.

Any advice is highly appreciated!

Thank you
Peter



0 Kudos
Message 1 of 3
(6,638 Views)
Hi,
 
For ezsurf, it is unable to specify external variable. The workaround is that
 
1. Hardcode the variable with the actual value, e.g.
 
    f = 'x+y*100'
    ezsurf(f)
 
2. Format the input string for ezsurf, e.g.
 
    scale = 100
    f = sprintf('x+y*%f', scale)
    ezsurf(f)
 
Let me know your special requirement.
0 Kudos
Message 2 of 3
(6,629 Views)
Hi,

thank you for the reply. I could solve my task with your suggestion.

Best regards
Peter


0 Kudos
Message 3 of 3
(6,625 Views)