MATLAB Answers

Export sldd to base workspace and get all entries

85 views (last 30 days)
Vinit
Vinit on 28 Oct 2016
Commented: Sabarirajan on 19 Jul 2020
Hello, How to export entries present in simulink data dictionary to base workspace or in var in 2016 version following code is working for 2014
hDict = Simulink.dd.open([dict_name,'.sldd']);
childNamesList = hDict.getChildNames('Global');
for n = 1:numel(childNamesList)
assignin('base',childNamesList{n},hDict.getEntry(['Global.',childNamesList{n}]));
end

  0 Comments

Sign in to comment.

Answers (1)

Donn Shull
Donn Shull on 10 Aug 2017
The method you show for 2014 uses an undocumented internal API which is subject to change without notice. Beginning with release R2015a there is a documented API for accessing Simulink Data Dictionaries. One way to implement the code you have shown using the documented API would be:
hDict = Simulink.data.dictionary.open([dict_name,'.sldd']);
hDesignData = hDict.getSection('Global');
childNamesList = hDesignData.evalin('who');
for n = 1:numel(childNamesList)
hEntry = hDesignData.getEntry(childNamesList{n});
assignin('base', hEntry.Name, hEntry.getValue);
end

  1 Comment

Sabarirajan
Sabarirajan on 19 Jul 2020
I want to export SLDD to Excel, is there any way ?
How to get the Object class type (prameter / Simulink) for workspace or from SLDD (Object)

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!