Previous: Publishing Markup, Up: Script Files [Contents][Index]
Jupyter notebooks are one popular technique for displaying code, text, and
graphical output together in a comprehensive manner. Octave can publish
results to a Jupyter notebook with the function jupyter_notebook
.
Run and fill the Jupyter Notebook in file notebook_filename from within GNU Octave.
Both text and graphical Octave outputs are supported.
This class has a public property notebook
which is a structure
representing the JSON-decoded Jupyter Notebook. This property is
intentionally public to enable advanced notebook manipulations.
Note: Jupyter Notebook versions (nbformat
) lower than 4.0 are not
supported.
The optional second argument options is a struct with fields:
tmpdir
to set the temporary working directory.
%plot
magic is supported with the following settings:
Examples:
## Run all cells and generate the filled notebook
## Instantiate an object from a notebook file
notebook = jupyter_notebook ("myNotebook.ipynb");
## Run the code and embed the results in the notebook
property
notebook.run_all ();
## Generate a new notebook by overwriting the original notebook
notebook.generate_notebook ("myNotebook.ipynb");
## Run just the second cell and generate the filled notebook
## Instantiate an object from a notebook file
notebook = jupyter_notebook ("myNotebook.ipynb");
## Run the code and embed the results in the notebook
property
notebook.run (2)
## Generate a new notebook in a new file
notebook.generate_notebook ("myNewNotebook.ipynb");
## Generate an Octave script from a notebook ## Instantiate an object from a notebook file notebook = jupyter_notebook ("myNotebook.ipynb"); ## Generate the Octave script notebook.generate_octave_script ("jup_script.m");
See also: jsondecode, jsonencode.
Previous: Publishing Markup, Up: Script Files [Contents][Index]