zoukankan      html  css  js  c++  java
  • 【Matlab】利用diary记录日志/保存命令窗口输出

    matlab 中可以利用diary函数记录下命令行窗口的输出到指定文件中,方便后期检查调试和运行信息。

    diary

    diary是matlab中的日志工具,可以将Command Window 中的内容保存到文件中去。使用方法:
    在命令行中输出:
    diary 'path/yourlogfile.txt'
    对应的的文件将会保存在path路径下的yourlogfile.txt文件里。
    同时,可以使用:
    diary off,diary on命令来关闭、打开日志。

    %diary使用例子
    >> diary 'mylog.txt'   %打开日志记录命令窗口
    >> disp('add this into mylog')
    add this into mylog
    >> 1+1
    ans =
         2
    >> diary off    %关闭了日志,不再记录
    >> disp('this will not log')
    this will not log
    >> diary on   %重新打开日志记录
    >> disp('this will be log')
    this will be log
    >> disp('this will be log')
    this will be log
    >> diary off   %关闭,保存记录
    

    在mylog.txt文件中就可一看到打开日志的几段命令和输出:
    在这里插入图片描述

    注意:结束时,需要利用diary off命令来结束日志,以便关闭文件保存日志。



    pic from pixels.com

  • 相关阅读:
    eclipse版本、代号
    eclipse中jdk及编译器版本问题
    改变cmd命令行颜色
    mysql-installer-community-8.0.12.0的安装
    算法简介
    Java--将数据以文本形式导出
    安装MySQL
    网络配置
    电脑拷软件到其他设备
    探针设备
  • 原文地址:https://www.cnblogs.com/Tom-Ren/p/10234989.html
Copyright © 2011-2022 走看看