MATLAB: How to use PackNGo without naming dependencies on the current directory

simulink coder

When using the 'Package code & artifacts' feature with code generation, the resulting .ZIP package contains two subfolders. One is named after the current directory, and the other is named after the release of MATLAB. Can this be avoided? I want to write a general (and fixed) makefile that compiles the generated code, but if the folders depend on the current directory then that makefile will have to change every time someone generates the code depending on what their pwd is.

Best Answer

If you do not want to have any sub-folders named after the PWD, you will need to use the 'flat' structure for 'packNGo'. To do this, you can use the command-line API instead of the model's configuration parameters. You will want to add a 'PostCodeGenCommand' with the 'set_param' function. For example:
>> set_param(gcs,'PostCodeGenCommand','packNGo(buildInfo,''packType'',''flat'',''fileName'',''myPackage'')');
For more information about the 'packNGo' command, please refer here:
For general information about using the command line with 'packNGo', please refer here: