save (FunctionNowFilename('test', '.mat' ));

 

%----------------------filename: FunctionNowFilename.m -----------------------

function [ fname ] = FunctionNowFilename( pre, post )
%NOW_FILENAME convert current time to filename
% NOW_FILENAME returns current time to filename as:
%           2010-02-23_093803413
% NOW_FILENAME('pre', 'post') returns
%           pre2010-02-23_094339313post
% NOW_FILENAME('eion-', '.mat') returns
%           eion-2010-02-23_094410117.mat
% AUTHOR: TANG Houjian @ 2010_02_12 10_04
    if nargin == 0
        pre = '';
        post = '';
    elseif nargin == 1
        post = '';
    end
    t = clock; % Get current time
    fname = [pre, num2str(t(1:1), '%04d'), ...  % Year
                  num2str(t(2:3), '%02d'), '_', ...   % -month-day_
                  num2str(t(4:5), '%02d'), ...  % hour min
                  num2str(fix(t(6)*1000),   '%05d'), post]; % sec+ms
end
%-----------------------------end of file now_filename.m-------------------

相关文章:

  • 2022-12-23
  • 2021-10-03
  • 2021-11-30
  • 2022-12-23
  • 2022-12-23
  • 2021-05-01
  • 2022-12-23
猜你喜欢
  • 2021-11-20
  • 2021-11-23
  • 2022-02-09
  • 2021-12-12
  • 2022-12-23
  • 2021-11-05
  • 2022-12-23
相关资源
相似解决方案