Why do I get an error when I try to assign a string value which contains blanks to a TLC variable with the -a option in Real-Time Workshop 5.0 (R13)?

8 views (last 30 days)
I have a TLC file called test.tlc that looks like:
%selectfile STDOUT
MyTestVariable = %<MyTestVariable>
If I execute this tlc file with this command:
tlc -aMyTestVariable="It_works" test.tlc
everything works fine. If I execute the tlc file with this command:
tlc -aMyTestVariable="It does not work" test.tlc
I got the following error message:
Error: File: execstring Line: 1 Column: 26
Unterminated string
Error: File: execstring Line: 1 Column: 29
syntax error
Error: Usage: tlc [options] file
-r <name>specify the record file (.rtw, .mdl, ...) to read
-v[N]specify the verbose level to be N (1 by default)
-I<path>specify a search path to look for %include and %generate files
-m[N|a]specify the maximum number of errors (a is all) default is 5.
-O<path>specify the path used to create output files
-d[a|c|n|o|f<filename>]specify debug mode (check assertions, command line debugger,
normal, off, or command line debugger batch file name)
-a<ident>=<expression>assign a variable to a specified value
-p<number>print a . indicating progress for every <number> lines of TLC code
-lintperform some simple performance checks and collect some runtime statistics
-x<number>if <number> = 1 (default) execute all TLC code; if = 0 just parse it
type "tlc server" for Server Mode usage.
??? Error: Errors occurred - aborting
Error in ==> D:\MATLAB6p5\toolbox\rtw\rtw\tlc_new.dll
Error in ==> D:\MATLAB6p5\toolbox\rtw\rtw\tlc.m
On line 77 ==> tlc_new(varargin{:});

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 27 Jun 2009
This bug has been fixed for Release 14 (R14). For previous releases, please read below for any possible workarounds:
To assign a string value to a TLC variable, the string inside of the double quotes must be protected by single quotes. For example, the correct format should be:
tlc -aMyTestVariable='"string with spaces"' test.tlc
This will be documented in a future release of the TLC documentation.

More Answers (0)

Categories

Find more on Simulink Coder in Help Center and File Exchange

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!