将Matlab结构打印到文本文件 [英] Print A Matlab Struct to a Text File
问题描述
我有一个Matlab程序,该程序会生成一组非常大的结构作为其输出.
这些结构足够大,我希望能够将文本表示形式打印到文本文件中以供以后研究.
I have a Matlab program which generates a set of very large structs as its output.
The structs are sufficiently large that I would like to be able to print the text representations to a text file for later study.
即命令:
foo(1)
foo(1)
将第一个结构发送到屏幕,但是结构太大而无法容纳在滚动窗口中,无论如何,滚动窗口对于查看这么大的文本块来说都是一个糟糕的工具.我希望能够将该命令的输出直接传递到文本文件.
sends the first of the structs to the screen, but the structure is too large to fit in the scroll window, and the scroll window is a poor tool for looking at such a large block of text, anyway. I would like to be able to pipe the output of that command directly to a text file.
不幸的是,未为结构中的某些元素定义fprintf,因此fprintf失败.同样,我相信Psychtoolbox库中的WriteStructsToText.m脚本也会失败.
Unfortunately, fprintf is not defined for some elements in the struct, and so fprintf fails. Likewise, I believe the WriteStructsToText.m script, which is part of the Psychtoolbox library, also fails.
有没有办法强迫Matlab将屏幕上显示的内容直接转储到文本文件中?
Is there any way to force Matlab to just dump what it is displaying on the screen directly into a text file?
推荐答案
diary
功能就是您想要的.
The diary
function is what you are looking for.
这篇关于将Matlab结构打印到文本文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!