如何在Matlab中将stdout重定向到stdin?又名如何管理文件描述符? [英] How to redirect stdout to stdin in Matlab? Aka how to manage file-descriptors?
问题描述
我的同事们创作了一部极难测试的小说解决方案
一个想法是使用 diary
将函数调用/脚本的输出保存到文件中.然后解析文件.同样按照Oleg的建议,您可以像evalc('functionName')
一样使用 evalc . /p>
My peers have created an extremely-hard-to-test novel structure where they use stdout for outputting results. Now I cannot change their code and I need to use their functions. Suppose a function mlfpprint
that uses stdout for displaying results -- now I need to check whether its results are correct so I need to get the stdout to a variable for comparison with the correct result. So
How can I manage file-descriptors in Matlab? For example, how can I get stdout to stdin?
One idea would be to use diary
to save the output of your function call/script to a file. Then parse the file. Also as Oleg recommended, you can use evalc like evalc('functionName')
.
这篇关于如何在Matlab中将stdout重定向到stdin?又名如何管理文件描述符?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!