notebook
Run a Notebook document.
📝Syntax
notebook(filename)
tf = notebook(filename)
📥Input Arguments
Parameter Description
filename a character vector or string scalar: a Notebook document (.nlx) or a Notebook plain-text file (.m).
📤Output Arguments
Parameter Description
tf a logical: true when the document ran.
📄Description

notebook runs a Notebook document without the editor: it reads the code of each code cell, in order, and evaluates it against the base workspace. Variables created in one cell are visible to the next, as when running the document in the editor.

The native .nlx container (a zip holding the document) and the plain-text .m Notebook format are both supported; an ordinary .m script is run as a single cell.

💡Examples
% build a minimal Notebook (.nlx) document and run it
d = [tempdir(), createGUID()];
mkdir(d);
fw = fopen([d, '/document.json'], 'wt');
fwrite(fw, '{"blocks":[{"type":"codecell","props":{"code":"a = 40 + 2;"}}]}');
fclose(fw);
nlx = [tempdir(), createGUID(), '.nlx'];
odir = pwd();
cd(d);
zip(nlx, 'document.json');
cd(odir);
notebook(nlx);
a
🔗See Also
nlxrunedit
🕔Version History
Version Description
2.0.0 initial version
Edit this page on GitHub