0

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.

  • Are you sure the scope was "Exported" when generating the code? For me the headerfile is generated (along with the correct #include statements). Any other setting will result in assuming the headerfiles are provided - and only the correct #include statements will be generated. – MonkeyProof Solutions Jul 28 '23 at 08:15

0 Answers0