Matlab: Simulink Coder - Generation of header files for every Bus variables

298 views Asked by At

I have added this code snippet to my Simulink Coder project in order to generate a header file for every Bus:

    % Get all the variables of the workspace
    vars = evalin('base', 'who');

    % Iterate through each variable
    for i = 1:numel(vars)
        varName = vars{i};
        var = evalin('base', varName);
        % Check if the variable is of type BUS
        if isa(var, 'Simulink.Bus')
        % Check if the headerfile property is empty
        if isempty(var.HeaderFile)
            % Assign a headerfile
            var.HeaderFile = ['header_', varName, '.h'];
            assignin('base', varName, var);
        end
        end
    end

The includes are created. in the form of "include header_BUSName.h..." However the header files are not generated in the repository. What could be missing ?

I have tried to change the data scope property to Exported and Imported % Chnage DataScope to Exported var.DataScope = 'Exported'; But the header Files are still not generated.

0

There are 0 answers