Mike on the MATLAB Desktop
March 15th, 2010
Archiving files in the Current Folder Browser
MATLAB projects are usually a series of self-contained folders of related code files and data. To facilitate sharing, we've found that many people create Zip archives of those folders so there is just one file to transfer. In previous versions of MATLAB you had to do this outside the MATLAB environment, but in MATLAB R2010a you can create Zip files, add additional files to existing Zips, and unpack them all from within the Current Folder Browser.
In previous editions, to zip up some files you could use an external tool, like WinZip, or the zip command, like so:
zip(fullfile(destdir,'output.zip'), '*.m')
Now it's simply a matter of selecting the files you want to include in the current folder, and with the right-click context menu, select "Create Zip File". You'll then get a chance to enter the name of the file. Since the folder browser shows directory trees, you can even select subfolders or parts of subfolders and include them in the Zip, preserving their folder structure.
To add additional files to a Zip file, just drag them onto the Zip file entry in the tree (you can also copy+paste them onto the zip). Double-clicking the entry will unpack the archive in a subfolder with the same name as the zip file.
That's pretty much all there is to the new feature. We expect that this will make it easier to share files between users, and make it easier to maintain backups of directories for those not using source control.
By
Michael Katz
Mike is a developer on the MATLAB Mobile team. When not describing himself in the third person, biking, homebrewing, or rooting for the home team, he's busy trying to make the world a better place for programming.
15:21 UTC |
Posted in Current Directory |
Permalink |
6 Comments »
You can follow any responses to this entry through the RSS 2.0 feed.
You can skip to the end and leave a response. Pinging is currently not allowed.
Leave a Reply
|
How to zip file1, file2 …..file10 using loop commands?
@nizam,
doc zip
This is a good addition to the matlab desktop. I think it would be very helpful if there was a programmatic way to handle zip-file browsing.
I’m processing large sets of small images. It’s very convenient to keep the 1000+ images (~500 kb each) from each series in a zip file. It would be really helpful to be able to keep them packed in an archive (making it easy to manage the raw data, and much quicker for backup to file servers), and still programmatically be able to list the file contents using something like:
Filenames = lszip('MyImageSequence.zip');That way I could iterate through the zip file contents without needing to unzip the entire file first.
@Francis – you can easily list the contents of a zip file using only a few lines of Java-based Matlab code, as follows:
-Yair
@Yair,
Thanks for getting that one. I knew as soon as I read Francis’ question, that you would have a java answer!
Is there a way of ADDING files to a zip file already containing other files?
Whenever I try it, it creates a new file and delets the content of the old Zip file.
(using R2010b)
Thanks JANI