Agent skill · Data & Analytics

matlab-modernize-daq

Port MATLAB Data Acquisition Toolbox code from the discouraged (legacy) session-based interface (daq.createSession, addAnalogInputChannel, startBackground, DataAvailable listeners, queueOutputData, wait) to the recommended DataAcquisition interface (daq("ni"), addinput, start, ScansAvailableFcn, write, preload). Use when migrating legacy DAQ scripts, converting session-API calls, working with DataAcquisition objects, writing multi-feature DAQ scripts that combine triggers, callbacks, continuous acquisition, or analog output. Also use when a user says their DAQ script "used to work" or "errors

matlabgithub.com/matlabGitHub ↗
claude-codecodexcopilotNOASSERTION
Install
npx skills add matlab/matlab-agentic-toolkit --skill matlab-modernize-daq --agent claude-code

Same command for any agent — swap --agent for codex, cursor, copilot.

Facts
Files in the skill folder: 6
SKILL.md size: 18 KB
Bundled scripts: none
Version: 1.0
Declared author: MathWorks
Path: skills-catalog/test-and-measurement/matlab-modernize-daq/SKILL.md
Open the folder on GitHub →
Where it comes from
Stars: 868
Language: MATLAB

Weekly change comes from our own snapshots, not the repository page — it measures attention, not adoption.

From the SKILL.md

# Port DAQ Code to the Modern DataAcquisition Interface Translate legacy session-based Data Acquisition Toolbox code (`daq.createSession`, `addAnalogInputChannel`, `DataAvailable` listeners, `startBackground`, `queueOutputData`, `wait`) to the modern `DataAcquisition` interface introduced in R2020a (`daq("ni")`, `addinput`, `ScansAvailableFcn`, `start`, `write`, `preload`). Also covers writing new multi-feature DAQ scripts where the modern API patterns are easy to get wrong under cognitive load. ## When to Use - Porting an existing script that calls `daq.createSession`, `addAnalogInputChannel`, `addAnalogOutputChannel`, `addCounterInputChannel`, `addCounterOutputChannel`, or `addDigitalChannel`. - Replacing `DataAvailable` / `DataRequired` / `ErrorOccurred` listeners with `ScansAvailableFcn` / `ScansRequiredFcn` / `ErrorOccurredFcn`. - Replacing `startBackground` / `startForeground` / `s.wait()` lifecycle calls. - Replacing `queueOutputData` with `preload` + `write`. - Writing a **new** DAQ script that combines two or more of: external triggers, continuous acquisition, callback-driven streaming, analog output with refill, or cross-callback state. - Debugging errors like `Undefined

What's inside
Steps it walks through
  1. When to Use
  2. When NOT to Use
  3. Workflow
  4. Key Functions
  5. Patterns
  6. Pattern 1: Add an external start trigger
  7. Pattern 2: ScansAvailableFcn body — pull data via read, never evt.Data
  8. Pattern 3: Block until acquisition completes — there is no wait(d)
  9. Pattern 4: Continuous AO playback with auto-refill
  10. Pattern 5: Cross-callback state via nested function or handle class
  11. Conventions
  12. Common Mistakes
  13. References
Ships with 5 files
  • manifest.yaml
  • references/callback-state-patterns.md
  • references/canonical-snippets.md
  • references/session-to-modern-mapping.md
  • scripts/verifyDataAcquisition.m
More from matlab-agentic-toolkit
All skills →
About this skill
What does the matlab-modernize-daq skill do?

Port MATLAB Data Acquisition Toolbox code from the discouraged (legacy) session-based interface (daq.createSession, addAnalogInputChannel, startBackground, DataAvailable listeners, queueOutputData, wait) to the recommended DataAcquisition interface (daq("ni"), addinput, start, ScansAvailableFcn, write, preload). Use when migrating legacy DAQ scripts, converting session-API calls, working with DataAcquisition objects, writing multi-feature DAQ scripts that combine triggers, callbacks, continuous acquisition, or analog output. Also use when a user says their DAQ script "used to work" or "errors

How do I install it?

Run `npx skills add matlab/matlab-agentic-toolkit --skill matlab-modernize-daq --agent claude-code` — it drops the skill into your project so the agent can pick it up. Swap the --agent value for codex, cursor or copilot if you use one of those.

Where does this skill come from?

From matlab/matlab-agentic-toolkit, a repository with 868 stars. We read it straight from the repository tree rather than a submitted listing, so what you see here is what is actually published.

Is a popular skill a good skill?

Not necessarily. Stars measure attention, not adoption — a repository can trend for a week and be abandoned. That is why we show the weekly change from our own snapshots next to the total, instead of a single flattering number.

Keep going