Menu

MatlabbatchDevelopmentCfgUtilExample

Volkmar Glauche

This code snippet demonstrates how cfg_util callbacks can be used to access information from a default configuration of batch modules. First, a list of available modules is returned:

mod_cfg_idlist = cfg_util('listcfg', [], cfg_findspec);  % List all cfg_exbranch items

Then, the help field will be extracted from the default configuration in two steps. This is just an example, any other field of a cfg_item can be listed. In addition, some special properties like 'class', 'all_set' can be listed. For details, see the help text in cfg_item/list.

fields = {'help'}; % fields/infos to list.

In a first step cfg_util('listcfgall',...) is called to list every help text in the menu structure above the cfg_exbranch level.

[unused, unused1, top_contents] = cfg_util('listcfgall', [], cfg_findspec, fields); % List top level help texts up to cfg_exbranch level

Then, the help field of each item in each module is listed. The listing could be restricted to a certain type of inputs by a cfg_findspec, or configuration tree traversal could be limited by cfg_tropts.

item_contents = cell(size(mod_cfg_idlist));
tropts = cfg_tropts(cfg_findspec,1,inf,1,inf,true);
for cmod = 1:numel(mod_cfg_idlist) % loop over cfg_exbranch items, listing their help fields
    [unused, unused1, item_contents{cmod}] = cfg_util('listmod', mod_cfg_idlist{1}, '', cfg_findspec, tropts, fields);
end

Related

Wiki: MatlabbatchDevelopment

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.