比方说,我有这样的MATLAB功能MATLAB bash脚本
function a = testfun(filename)
% do something with file contents and create some variable a
disp(a);
我想有一个在Cygwin运行shell脚本如下:
./testscript.sh <inputforfunction.txt> outputoffunction.txt
输入文件将包含数据I需要。 运行此命令后,输出文件将包含运行testfun(filename)的结果。
到目前为止,我可以将输出写入文件outputoffunction.txt。
问题是我想读取文件名“inputforfunction.txt”。
我能够在文件内容但不是文件名阅读,任何提示吗? 谢谢!
感谢您的建议,但我知道这个选项,不幸的是,我被限制重定向输入和输出。 – lyes 2013-03-24 17:27:33
@ LyesKhalil - 你有可能重定向'echo inputforfunction.txt'吗? – Shai 2013-03-24 17:50:18
不知道我有什么意思 – lyes 2013-03-24 20:02:11