Main Content

exportToFile

Export data dictionary entries from section to MAT-file or MATLAB file

Description

example

exportToFile(sectionObj,fileName) exports to a MAT or MATLAB file all the values of the entries contained in the data dictionary section sectionObj, a Simulink.data.dictionary.Section object. exportToFile exports the values of all entries, including those defined in referenced dictionaries.

Examples

collapse all

Represent the Design Data section of the data dictionary myDictionary_ex_API.sldd with a Simulink.data.dictionary.Section object named dDataSectObj. Represent the Configurations section of myDictionary_ex_API.sldd with an object named configSectObj.

myDictionaryObj = Simulink.data.dictionary.open('myDictionary_ex_API.sldd');
dDataSectObj = getSection(myDictionaryObj,'Design Data');
configSectObj = getSection(myDictionaryObj,'Configurations');

Export the entries from the Design Data section of myDictionary_ex_API.sldd to a MATLAB file in your current working folder.

exportToFile(dDataSectObj,'myDictionaryDesignData.m')

Export the entries from the Configurations section of myDictionary_ex_API.sldd to a MAT-file in your current working folder.

exportToFile(configSectObj,'myDictionaryConfigurations.mat')
Exported 1 entries from scope 'Configurations' 
to MAT-file myDictionaryConfigurations.mat.

Input Arguments

collapse all

Target data dictionary section, specified as a Simulink.data.dictionary.Section object. Before you use this function, represent the target section with a Simulink.data.dictionary.Section object by using, for example, the getSection function.

Name of target MAT or MATLAB file, specified as a character vector. exportToFile supplies a file extension .mat if you do not specify an extension.

Example: 'myNewFile.mat'

Example: 'myNewFile.m'

Data Types: char

Limitation

The exportToFile method does not export enumerated data types (which are stored as Simulink.data.dictionary.EnumTypeDefinition objects). To transfer or copy an enumerated type from one dictionary to another, use the getEntry and addEntry methods of Simulink.data.dictionary.Section objects.

Alternatives

You can use Model Explorer to export data dictionary entries to a file. See Export Design Data from Dictionary for more information.

Version History

Introduced in R2015a