File Exchange

image thumbnail


version (3 KB) by Meade
Compile Zip archives and automatically include all dependencies.


Updated 18 Jul 2018

View Version History

View License

I often need to share a short script, function, or model with colleagues, where it would be cumbersome to create a more formalized git or svn repository. In these cases, I'll usually just zip up the file(s) but of course still want to make sure that I include all the necessary file dependencies.
pack_n_go is an easy way to compress a Matlab script, function, model, or directory into a *.zip archive to share.
It will automatically calculate and include any dependencies that are found.
Additionally, it will create a text file within the archive listing all the necessary Matlab products or Toolboxes (and versions) required to run.

pack_n_go can be used by explicitly passing a file or directory to it. Or, if no arguments are passed, it will zip up the currently active Matlab Editor file. This latter case is ideal for use as a shortcut button.

Cite As

Meade (2021). pack_n_go (, MATLAB Central File Exchange. Retrieved .

Comments and Ratings (7)

Tom Strizic

Works just as described. Very easy to save and share projects spread over multiple folders.


The updates to the function allow you to include (or not) the dependencies as a separate file in the zip archive. If you set the 'ReadMeMode' flag to 'console', then your code will be zipped up, but the dependencies will only show up in the Matlab console window (no ReadMe file written). Additionally, you can now just create a new folder instead of a zip archive.

You are right that there is no option to only display the dependencies without also making a new zip archive or folder. If you only want to display dependencies, and not do anything else, I suggest the |matlab.codetools.requiredFilesAndProducts| function, it's what I'm using under-the-hood to calculate things.

Hope that helps.


maybe I'm not understanding your options correctly, but is there a way to just display the dependencies in the console with no files being written, neither zip nor folder?

Chang hsiung



Good suggestions! I've updated the function to include both ideas.
Thanks for the feedback.



I would like to suggest that you add an option for (just) displaying the readme.txt in the matlab console and maybe an option to not zip :)


great stuff! This would have saved me days of my life over the years. It should have been a no brainer for Mathworks to include this a decade ago!

MATLAB Release Compatibility
Created with R2015b
Compatible with any release
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!