MATLAB: How to call a command prompt variable when executing operating system command from Matlab

command prompt variableMATLABoperating system command

Dear all,
I am trying to call a command prompt variable from within a operating system command using Matlab. An example of what I want to run using the command prompt:
set expr=$1=179*($1*0.265+$2*0.670+$3*0.065) & echo %expr%
Gets me the output I would like:
$1=179*($1*0.265+$2*0.670+$3*0.065)
When I try to run this from Matlab, using the following script:
cmd = 'set expr=$1=179*($1*0.265+$2*0.670+$3*0.065) & echo %expr%'
[status,cmdout] = system(cmd)
I get the following output:
cmdout =
'%expr%
'
Which suggests that matlab surrounds the %expr% in quotations before it sends the command to the command prompt.
The reason I am trying to do all this is because I want to use the string in expr as an input argument of a Radiance program which was written for Unix. The only way which I found I could do this on a Windows system is by first defining a variable containing the expression as a string and then calling this string from within the Radiance command argument.
I hope someone could shed some light on how I could solve this.
Kind regards,
Samuel

Best Answer

Question answered by Looky in the comments.