diff --git a/modules/matlab/generator/gen_matlab.py b/modules/matlab/generator/gen_matlab.py index 2b317a6782..b132a819db 100644 --- a/modules/matlab/generator/gen_matlab.py +++ b/modules/matlab/generator/gen_matlab.py @@ -33,7 +33,6 @@ class MatlabWrapperGenerator(object): jtemplate.filters['void'] = void jtemplate.filters['not'] = flip - # load the templates tfunction = jtemplate.get_template('template_function_base.cpp') tclassm = jtemplate.get_template('template_class_base.m') diff --git a/modules/matlab/generator/templates/template_map_base.cpp b/modules/matlab/generator/templates/template_map_base.cpp index 0d39d7165f..791b2c93a3 100644 --- a/modules/matlab/generator/templates/template_map_base.cpp +++ b/modules/matlab/generator/templates/template_map_base.cpp @@ -22,6 +22,10 @@ typedef std::unordered_map Map; */ Map constants = { {% for key, val in constants.items() %} + {% if val|convertibleToInt %} { "{{key}}", {{val}} }, + {% else %} + { "{{key}}", {{constants[val]}} }, + {% endif %} {% endfor %} };