notebook(filename)
tf = notebook(filename)
| Parameter | Description |
|---|---|
| filename | a character vector or string scalar: a Notebook document (.nlx) or a Notebook plain-text file (.m). |
| Parameter | Description |
|---|---|
| tf | a logical: true when the document ran. |
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.
% 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
| Version | Description |
|---|---|
| 2.0.0 | initial version |