11.04.2013 Views

UniBasic Commands Reference - Rocket Software

UniBasic Commands Reference - Rocket Software

UniBasic Commands Reference - Rocket Software

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

INMAT Function Return Values<br />

After you execute MATPARSE, the INMAT function returns one of the values<br />

described in the following table.<br />

Value Description<br />

n The number of elements loaded into the array.<br />

0 The array was too small to contain all elements in the string. All excess data<br />

(including delimiters) is placed in the 0,0 element.<br />

INMAT Function Return Values<br />

Examples<br />

In the following example, the program segment fills the dimensioned array ALPHA<br />

with consecutive characters from a literal string. An empty string is the delimiter,<br />

causing one character to be assigned to each dimensioned array cell. In this case, the<br />

value returned by the INMAT function would be 7.<br />

DIM ALPHA(7)<br />

MATPARSE ALPHA FROM "ABCDEFG",""<br />

The preceding program segment produces the following dimensioned array:<br />

ALPHA(1) = "A"<br />

.<br />

.<br />

.<br />

ALPHA(7) = "G"<br />

In the next example, the program segment dimensions the dimensioned array T and<br />

then fills it with data from a dynamic array. The delimiter specified is the attribute<br />

mark, so each attribute is assigned to consecutive elements of the array. Note that the<br />

string “ITEM” has five elements, but the array is dimensioned with four elements.<br />

After the MATPARSE command, the INMAT function is 0 and the value of the zero<br />

element T(0) is 443.<br />

DIM T(4)<br />

ITEM = "123:@AM:33:@AM:199:@AM:821:@AM:443"<br />

MATPARSE T FROM ITEM, CHAR(254)<br />

MATPARSE 1-447

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!