如何将命令的Matlab输出重定向到文件? [英] How to redirect Matlab output of a command to a file?

查看:159
本文介绍了如何将命令的Matlab输出重定向到文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想将Matlab命令的输出重定向或复制到文件中.我该怎么办?

I want to redirect or copy the output of a Matlab command to a file. How can I do that?

就我而言,我想使用UNIX工具diff比较两个大型结构.

In my case, I have two large structs that I want to compare using the UNIX tool diff.

示例:我可以在Matlab中完成此操作

Example: I can do this in Matlab:

>> s1

s1 = 

      a: 32
    abc: 'example'

>> 

并想要一个包含大约:

s1 = 

      a: 32
    abc: 'example'

这些解决方案不可行:

  • 复制动作:无法(舒适地)自动化.
  • save -ascii:不适用于结构.
  • Copy-pase: can't automate (comfortably).
  • save -ascii: does not work with structs.

推荐答案

看看文件my_file.txt将完全包含您在屏幕上看到的内容.

The file my_file.txt will then contain exactly what you see on screen.

这篇关于如何将命令的Matlab输出重定向到文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆