saving struct array is slow and returns an error message

i have a small struct array that when i try to save returns
Error using save
Error closing file
/Users/fchang/Dropbox/Public/smalldataset/fcProcessedStorage/201601-test-adf/s1/[fcSpotDetection]/spotMLEs/spotMLEs(BWY819-14_w2-FITC(WhiteTTL)_s1_t1).mat.
when i use try /catch around the save, there is no error message, and the file is successfully saved. first of all, it takes a long time, and second why is there an error message? i tried several save version flags and it does not matter for both problems.
linked is the workspace save (that also returns the error message but file is saved anyways)
spotMLEstructArray =
13x1 struct array with fields:
data
theta0
readNoise
domains
type
thetaMLE
thetaVar
lambdaModel
maxThetas
gradFunc
hessFunc
logLike
K>> whos spotMLEstructArray Name Size Bytes Class Attributes
spotMLEstructArray 13x1 67592 struct

Answers (1)

Saving to networked files is often slow. If you have enough disk space it is usually faster to save to local disk and then to copy the saved .mat to the networked disk. For example,
tfile = [ tempname() '.mat' ];
destfile = '/Users/fchang/Dropbox/Public/smalldataset/fcProcessedStorage/201601-test-adf/s1/[fcSpotDetection]/spotMLEs/spotMLEs(BWY819-14_w2-FITC(WhiteTTL)_s1_t1).mat';
save(tfile, 'variable1', 'variable2', ...)
system( sprintf('mv "%s" "%s"', tfile, destfile) );

1 Comment

note that the dropbox folder is on the local drive (ssd), so the slowness of the save function is not limited by this. just to make sure, i also tried saving to my desktop (local drive, ssd) and it is slow + reports same error
also note that the variable being saved, the struct array, is relatively small, so size of the data being saved is not a factor.

Sign in to comment.

Categories

Products

Asked:

on 12 Oct 2016

Commented:

on 12 Oct 2016

Community Treasure Hunt

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

Start Hunting!