zoukankan      html  css  js  c++  java
  • Matlab--保存数据,且文件以时间命名

    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-------------------

  • 相关阅读:
    使用webpack + momentjs
    关于vue3的proxy代理的简单实现
    电脑网卡重置
    Cookie加密处理
    浅谈 JS 防抖和节流
    WebSocket 与 Socket.IO
    React中useState,useEffect的使用
    react中Context的使用
    React中匿名插槽与具名插槽的使用
    React中PureComponent的使用
  • 原文地址:https://www.cnblogs.com/helloweworld/p/3522585.html
Copyright © 2011-2022 走看看