In Fortran, I can use include "file" to insert a piece of code. Is there a similar method in Mathematica?
Tell me more
×
Mathematica Stack Exchange is a question and answer site for
users of Mathematica. It's 100% free, no registration required.
|
|
||||
|
The answer is very simple: Put your external code snippet into a file
Now in the "parent" notebook (assuming it's in the same directory as the code snippet), execute the command
or
and you're done. Here are the references for << ( |
||||
|
|
include "file"is completely different from using a package.includecopies the content offiledirectly and put it at the place whereincludestatement was. It acts exactly as if one used an editor and used copy-paste to put extra code at that location. This is the same withc #includeas well. Here is reference to Fortran include. docs.oracle.com/cd/E19957-01/805-4939/6j4m0vna1/index.html – Nasser Dec 27 '12 at 15:10