Zip up matlab demo and dependencies

Alec Jacobson

August 27, 2013

weblog/

I use this all the time to zip up little matlab demos. Let mydemo.m be the name of your demo script:

>> name_of_script = 'mydemo';
>> C = depends(name_of_script);
>> C = C(cellfun(@isempty,strfind(C,'/local/mosek')));
%>> C = cat(1,C,{'README';});
>> zip([name_of_script '.zip'],C);
>> fprintf('This package should contain\n%s/\n',name_of_script);
>> N = regexprep(C,'^.*\/','');
>> fprintf('  %s\n',N{:});

I paste this in the comments at the top of my script so that I can easy copy paste it to create a new zip. Notice that I'm removing mosek dependencies (you could replace this with any other large dependencies you don't want to include). And I can explicitly add other non-dependency files like a README or perhaps some data (e.g. mymesh.obj).