我正在尝试通知 Erlang 进程外部程序(Matlab 脚本)已完成。我正在使用批处理文件来执行此操作,并且想输入一个命令来通知 Erlang 进程完成。这是主要代码:
在 myerlangprogram.erl 中:
runmatlab() ->
receive
updatemodel->
os:cmd("matlabscript.bat"),
...
end.
在 matlabscript.bat 中:
matlab -nosplash -nodesktop -r "addpath('C:/mypath/'); mymatlabscript; %quit;"
%% I would like to notify erlang of completion here....
exit
如您所见,我正在使用 'os:cmd' erlang 函数来调用我的 matlab 脚本。
我不确定这是最好的方法。我一直在研究使用端口(http://www.erlang.org/doc/reference_manual/ports.html),但我很难理解端口如何/在何处与操作系统交互。
总之,我的两个问题是: 1. 从命令行向 Erlang 进程发送消息的最简单方法是什么?2. erlang 端口在哪里/如何从/向操作系统接收/发送数据?
对此的任何建议将不胜感激。
注意操作系统是windows 7。