Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我在 Mathematica nb.file 中有代码,我想通过 Net/Link 在我的 VB 应用程序中使用它。 有什么方法可以直接使用 nb.file 中的代码吗?例如,我将通过 VB 在 Mathematica 中执行代码?
一种方法是构造一个类似于以下指令的字符串,并将其发送到 .NET 中的 mathkernel Compute 函数:
Needs["JLink`"]; $FrontEndLaunchCommand = "Mathematica.exe"; UseFrontEnd[nb = NotebookOpen["C:\\Temp\\run.nb"]; SelectionMove[nb, Next, Cell]; SelectionEvaluate[nb];]; Pause[10]; CloseFrontEnd[];
参考。由 JLink 或 UseFrontEnd 生成的未捕获抛出