Batch input and output in Mathematica?

亡梦爱人 提交于 2019-12-09 17:51:53

问题


Recently I found some old post on MathGroup where usage of undocumented command-line options -batchinput and -batchoutput is shown:

 If test.mma contains the following commands:

    a=2+2
    b=10!;
    a+b

 then, running Mathematica in batch mode, only output for the first and 
 third commands goes to stdout:

    # math -batchinput -batchoutput < test.mma

    4

    3628804

But when trying to reproduce this behavior under Windows I get only first output printed in the console window. What am I doing wrong?


回答1:


I tested it and got both numbers as output. HOWEVER, if the last command is not followed by a carriage return, the output is exactly what you posted!

So, please check that you are ending your last line with a carriage return.



来源:https://stackoverflow.com/questions/6542537/batch-input-and-output-in-mathematica

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!