3 %> @brief Populates listbox/popupmenu with variables in workspace that belong to certain
class
5 %> Note:
"leave blank" option should be used with popup menus only.
8 %> @param h_list Handle to listbox or popupmenu
9 %> @param flag_blank=0 Whether to include a
"(leave blank)" option
10 %> @param string_empty (optional) String to show instead of the default <b>(leave blank)</b> or <b>(none)</b> entries.
11 %> May also be a cell of strings. In this case, all options in the cell will be added at the beginning.
12 %> @param input (optional) (may be either a
string with a class name or an instance of such class)
13 %> Input class to match. This is applicable only if @c classname is "
block" or descendant.
16 if ~exist('input', 'var')
20 idxs = get(h_list, 'Value');
24 if ~exist('flag_blank', 'var')
28 if ~exist('string_empty', 'var')
30 string_empty = 'leave blank';
32 string_empty = 'none';
43 if ~isempty(find(idxs > length(vars)))
44 set(h_list, 'Value', 1); %> Prevents from selection falling beyond listbox items (MATLAB does not do it automatically)
46 set(h_list, 'String', vars);
52 c = cellfun(@(x)
iif(x(1) ~= '(', ['(', x, ')'], x), s, 'UniformOutput', 0);
function get_varnames(in classname, in input)
function iif(in cond, in x1, in x2)
function listbox_load_from_workspace(in classname, in h_list, in flag_blank, in string_empty, in input)