samer@0: function locator=dbsave(x) samer@0: % dbsave - Save object to MatBase using given name samer@0: % samer@0: % dbsave :: A -> action locator(A). samer@0: samer@0: % SA: 2008-05-20 - no longer saving file name in mat file samer@0: samer@0: dt=clock; samer@0: [root,host]=dbroot; samer@0: dir=[host dirname(dt)]; % makes up a directory name based on the date. samer@0: if ~exist(fullfile(root,dir),'dir') samer@0: [rc,msg]=mkdir(strrep(root,'~',getenv('HOME')),dir); samer@0: end samer@0: samer@0: fn=uniquefile(dt,root,dir,'m%s.mat'); % make up a filename samer@0: save(fullfile(root,fn),'x'); samer@0: locator=[removeext(fn),'|x']; samer@0: samer@0: % make up directory name based on the year and month samer@0: function dir=dirname(dt) samer@0: dir=sprintf('d%s%s',datestr(dt,'yy'),datestr(dt,'mm')); samer@0: samer@0: