File Exchange

image thumbnail


version (4.89 KB) by M MA
Creation of self-extract packages.


Updated 28 Sep 2005

View License

Creates a single MATLAB self-extract p (and m) file with all the contents of a selected folder.
When executed, the output file will recreate the package inside a folder with the same name of the main package folder. For instance if the selected folder is "/home/user/package", the creted folder during extraction will be "package".

The screenshot shows the creation of the p file of the saved MathWorks site at the folder /tmp/matlab_site

Cite As

M MA (2020). selfpack (, MATLAB Central File Exchange. Retrieved .

Comments and Ratings (2)

Durga Shrestha

I have modified the 'selfpack' which can do the followings:

1. Filter to include or exclude files. E.g. {'~.m' '~.asv'} excludes all the m-files and asv files in the pack. Similiarly {'*.p'} includes only p-files.

2. User defined installation folder (in the orginal version, the files are installed into the current directory).

3. The folders are automatically added to the MATLAB path.

I am planning to submit it to the file exchange, but i am not sure if i am allowed.

Durga Shrestha

Nice utility, but there is error message:
?? Error using ==> fileparts at 17
Input must be a row vector of characters.

Error in ==> selfpack>basename at 483

Error in ==> selfpack at 55
lastDir = basename(theDir);

I went to the code and commenting the following lines works.
%deal with filesep:
theDir = strrep(theDir,'/',filesep);
theDir = strrep(theDir,'\',filesep);
theDir = strrep(theDir,':',filesep);
theDir = realpath(theDir);

It will be nice to have filter of certain files. For example i have p-files and m-files and want to deploy only p-files but not m-files.
Another nice work would be to add path automatically after installing to the user defined folder.
Othewise it is very nice work.

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

Inspired: aselfpack