Markdown notebooks
RunMat notebooks combine Markdown with runnable MATLAB-syntax code cells. Use them for analyses, experiments, and reports where readers need the explanation and result beside the code.
Notebook files remain ordinary .md files, so they work with version control, code review, and other Markdown tools.
Create a notebook
Create or open a Markdown file and add a fenced matlab code block:
## Frequency response
The following cell evaluates a first-order low-pass response.
```matlab
f = logspace(0, 4, 500);
H = 1 ./ (1 + 1i*f/250);
semilogx(f, 20*log10(abs(H)));
xlabel("Frequency (Hz)");
ylabel("Magnitude (dB)");
```Desktop recognizes runnable cells and displays their output and figures with the surrounding Markdown. Keep reusable functions in .m files and call them from notebook cells.
Run cells
Run a single cell while exploring, or run the complete notebook from the beginning to verify the result. Cells share a workspace, so their order matters when one cell uses variables created by another.
Desktop marks saved output as stale after the corresponding source changes. Rerun that cell and any cells that depend on it. Before sharing a notebook, run it from the beginning with the intended project configuration and data.
The notebook run mode controls whether a full run stops at the first error or continues to later cells. After cancelling a run, Desktop can either run the remaining cells or restart from the beginning. These options are available under Settings > Advanced settings.
Save outputs
Enable Persist runs to retain notebook output, variables, and supported figures. Large values and interactive figure data are stored with the project rather than embedded directly in the Markdown text.
Saved output records what a previous run produced. A full rerun confirms that the current source, dependencies, and data still produce it. Include required datasets, package versions, and configuration in the project when others need to reproduce the notebook.
Edit and review
Switch to Markdown source mode to edit the underlying text directly or inspect a formatting problem. Changes to prose and code remain easy to review in a normal diff. Output changes should correspond to an intentional code, data, or configuration change.
If output is missing, run the cell again. If a notebook fails to render, open source mode and check the surrounding code fences. See Run history and replay for saved workspace and figure behavior.