To convert a string to its numeric equivalent, To convert ascii code (integer) to a string, To convert an object to a string – Pinnacle Speakers DEKO500 User Manual

Page 131

Advertising
background image

Macro Programming Language

129

Deko500 User’s Guide

$a = 123.45

$b = num2str $a

$b equals "123.45"

Concatenate a null string to the number

$a = 123.45

$b = $a%%""

$b equals "123.45"

To convert a string to its numeric equivalent:

Use the command:

str2num

$a = "123"

$b = str2num $a

$b equals 123

To convert a string (up to 4 characters) to ASCII code
(integer):

Use the command:

str2ascii

$a = "a"

$b = str2ascii $a

$b equals 97

To convert ASCII code (integer) to a string:

Use the command:

ascii2str

$a = 97

$b = ascii2str $a

$b equals "a"

To convert an object to a string:

Use the command:

obj2str

$a = @black

$b = obj2str $a

$b equals "yuv 16 0 0"

Advertising