saving struct array is slow and returns an error message
Show older comments
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)
Walter Roberson
on 12 Oct 2016
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
Frederick Chang
on 12 Oct 2016
Categories
Find more on Structures in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!