Anju
Anju

Reputation: 25

Running Matlab Command From Tcl

From my TCL script I like to open Matlab command window and display if its Matlab win32 or win64.

Therefore I use the following command:

exec {*}matlab -nodisplay -nosplash -nodesktop -r  "arch = computer; fprintf('%s \n', arch')";

However I keep getting error:

arch = computer; fprintf('%s 
                          |
Error: String is not terminated properly.

If I run the same in Matlab no issues.

Could some kindly advice.

Thanks

Anj.

Upvotes: 0

Views: 661

Answers (1)

glenn jackman
glenn jackman

Reputation: 246764

Tcl is substituting the \n before handing the command to matlab. Escape it:

exec matlab ... -r  "arch = computer; fprintf('%s \\n', arch')"

Or use braces

exec matlab ... -r  {arch = computer; fprintf('%s \n', arch')}

Upvotes: 1

Related Questions