// The shared .m files, shown read-only. The editable script in each lab is // the method itself; these are the pieces every lab is allowed to assume. import { useState } from 'react' const raw = import.meta.glob('../matlab/*.m', { query: '?raw', import: 'default', eager: true }) as Record< string, string > const FILES = Object.entries(raw) .map(([path, content]) => ({ name: path.slice(path.lastIndexOf('/') + 1), content })) .sort((a, b) => a.name.localeCompare(b.name)) export default function LibraryView() { const [open, setOpen] = useState(FILES[0]?.name ?? null) return (
Reference

The shared MATLAB library

Every lab boots with these function files in its session, alongside the editable script and a driver that reads the controls and writes the figures. They are the small pieces that would otherwise be repeated in every chapter.

{FILES.map((f) => (
{open === f.name &&
{f.content}
}
))}
) }