preraulab_utilities

Meta-repository bundling the Prerau Lab’s general-purpose MATLAB utilities — binning, conversions, figure layout, plotting primitives, statistics, and workspace management.

Each category is its own standalone repository. This site is the aggregated reference pulled directly from docstrings in every sub-repo.

Standalone + bundled

Each category below is a separate git repository that can be cloned and used on its own. This repo aggregates them as submodules, so a recursive clone (git clone --recursive) or git submodule update --init --recursive pulls everything.

Browse by category

Binning

1-D and N-D binning, sliding-window histograms.

Functions: create_bins, create_NDbins, hist_slide

Binning
Conversion

Type, format, and representation conversions — numbers to strings, structs to name-value cells, tables ↔ CSV.

11 functions

Conversion
Data Processing

Generic signal and index manipulation — consecutive runs, chunk detection, interval arithmetic.

6 functions

Data Processing
Figure Tools

Figure layout, axes linking, interactive controls — the plumbing for good-looking multi-panel figures.

23 functions

Figure Tools
Graphical

Higher-level plot primitives — shaded bounds, Gantt charts, phase histograms, wireframes.

10 functions

Graphical
nanstats

NaN-aware statistical helpers.

Functions: nanzscore, nanpow2db

nanstats
Workspace

Workspace management — clear, close, package.

Functions: ccc, clear_all_except, packagecode

Workspace
CSSuicontrols

CSS-styled HTML-backed UI controls for uifigure apps — modern animated components without writing JavaScript.

Classes: CSSuiButton, CSSuiDropdown, CSSuiListBox, SmoothProgressBar, …

https://github.com/preraulab/CSSuicontrols
read_EDF

EDF / EDF+ reader with MEX acceleration, A-B rereferencing, annotation parsing, and de-identification.

Functions: read_EDF, header_gui

https://github.com/preraulab/read_EDF

Quick examples

Consistent multi-panel figures

ax = figdesign(2, 3);
letter_label(ax, 'A', 'TopLeft');
linkcaxes(ax);
scrollzoompan(ax(1), 'x');

Bin and plot a point process

[counts, edges] = create_bins(spike_times, 0.050);  % 50 ms bins
shadebounds((edges(1:end-1)+edges(2:end))/2, counts, counts+sqrt(counts), counts-sqrt(counts));

Round-trip a struct to a command-line string

opts = struct('Fs', 200, 'thresh', 3.5, 'verbose', true);
disp(struct2nvpstr(opts));
% -> 'Fs', 200, 'thresh', 3.5, 'verbose', true

Install

addpath(genpath('/path/to/preraulab_utilities'));
savepath;   % optional

Design principles

  • R2020a-compatible. No arguments blocks, no name=value syntax, no dictionary.

  • Small, composable. Each function does one thing; complex behavior comes from combinations.

  • NaN-aware where sensible. Anything named nan* handles NaN gracefully.

  • No hidden state. Interactive controls store per-axes appdata, never globals.

  • Canonical docstrings. Every .m file uses the lab’s Usage/Inputs/Outputs/See also format — readable with help <function>.

Documentation map

Repository

Source code: https://github.com/preraulab/preraulab_utilities