View License

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video

Highlights from

Join the 15-year community celebration.

Play games and win prizes!

» Learn more

Be the first to rate this file! 2 Downloads (last 30 days) File Size: 1.67 KB File ID: #35079 Version: 1.0



Tristan Ursell (view profile)


You know that annoying error when trying to write to an image stack in Matlab?

| Watch this File

File Information

Image Stack Saver


For use with appended image stacks, e.g. most commonly stacked TIF files.
Some operating systems throw an error indicating that the file is
inaccessible at the time of write, which leads to a code fault and can be
very frustrating. This simple script fixes that issues, mainly on the
Windows operating system.

 Im1 = the current image (matrix) you want to add to the stack
 basename = is a string that specifices the file name, and potentially the
 path of the stack to save to. Best practice is the put '.tif' at the end
 of the file name.

 fmax = maximum number of allowed failures, i.e. if the script attempts to
 write to the file 'fmax' times and fails, it will give up. This prevents
 entering an infinite loop. The default value is fmax = 10.

 Any of the 'imwrite' parameters can be modified on line 38.

Required Products MATLAB
MATLAB release MATLAB 7.9 (R2009b)
Tags for This File   Please login to tag files.
Please login to add a comment or rating.

Contact us