Components All New MacOS Windows Linux iOS
Examples Mac & Win Server Client Guides Statistic FMM Blog Deprecated Old

Dictionary.ToMatrix

Converts dictionary to a matrix.

Component Version macOS Windows Linux Server iOS SDK
Dictionary 13.2 ✅ Yes ✅ Yes ✅ Yes ✅ Yes ✅ Yes
MBS( "Dictionary.ToMatrix"; DictionaryRef )   More

Parameters

Parameter Description Example
DictionaryRef The reference number to the dictionary. $dic

Result

Returns matrix reference number or error.

Description

Converts dictionary to a matrix.

Examples

Test dictionary to matrix conversion:

# create new dictioanry
Set Variable [ $dic ; Value: MBS( "Dictionary.Create" ) ]
# add two values
Set Variable [ $r ; Value: MBS( "Dictionary.SetValueForKey"; $dic; "Hello"; "World" ) ]
Set Variable [ $r ; Value: MBS( "Dictionary.SetValueForKey"; $dic; "Some"; "Value" ) ]
# now make a matrix from it
Set Variable [ $matrix ; Value: MBS( "Dictionary.ToMatrix"; $dic) ]
# check size
Set Variable [ $dCount ; Value: MBS( "Dictionary.Count"; $dic) ]
Set Variable [ $mCount ; Value: MBS( "Matrix.Height"; $matrix) ]
# query values
Set Variable [ $mCount ; Value: MBS( "Matrix.GetValue"; $matrix; 0; 0 ) ]
Set Variable [ $mCount ; Value: MBS( "Matrix.GetValue"; $matrix; 0; 1 ) ]
Set Variable [ $mCount ; Value: MBS( "Matrix.GetValue"; $matrix; 1; 0 ) ]
Set Variable [ $mCount ; Value: MBS( "Matrix.GetValue"; $matrix; 1; 1 ) ]
# query text to check
Set Variable [ $$text ; Value: MBS( "Matrix.Text"; $matrix) ]
# cleanup memory
Set Variable [ $r ; Value: MBS( "Dictionary.Release"; $dic ) ]
Set Variable [ $r ; Value: MBS( "Matrix.Release"; $matrix ) ]

See also

Release notes

Blog Entries

This function checks for a license.

Created 23th April 2023, last changed 23th April 2023


Dictionary.ToJSON - Dictionary.ToText