Stacks

Migrate a deprecated API across every callsite in MATLAB with Atlas in 2026

Updated 7 min read

Migrating a deprecated API across an entire MATLAB codebase without missing a single callsite is a critical job that Atlas, the terminal-native AI coding agent, simplifies by leveraging MATLAB's native tooling like `matlab.unittest (runtests)` and `MATLAB Format Code`. Atlas ensures a comprehensive and verified transition to the replacement API.

How Atlas finds all deprecated MATLAB API calls

Atlas ensures no deprecated MATLAB API callsite is missed by combining precise language server protocol (LSP) references with robust keyword search. In 2026, this hybrid approach guarantees a 100% enumeration of all usages, including dynamic or string-based invocations within your .m files.

To accurately identify every instance of a deprecated function or module in your MATLAB codebase, Atlas employs a two-pronged strategy. First, it utilizes the `lsp` tool's `findReferences` operation. This leverages MATLAB's language server capabilities to provide a complete, syntax-aware list of all direct callers of the specified deprecated symbol across your .m function files, class definitions, and `matlab.unittest` test classes. This is crucial for understanding the structural dependencies. Second, Atlas cross-checks these LSP results with a `grep` search for dynamic or string-based usages that might evade static analysis. This ensures that even calls constructed via `eval`, `feval`, or string literals referencing the deprecated name are identified, providing a truly exhaustive list of all callsites.

Managing MATLAB API migration tasks with Atlas todowrite

Managing the migration of a deprecated MATLAB API across potentially hundreds of files requires meticulous tracking. Atlas's `todowrite` tool transforms the enumerated callsites into actionable, visible tasks, ensuring that each of the 100+ identified locations is addressed and verified.

Once Atlas has enumerated all callsites of the deprecated MATLAB API, it uses the `todowrite` tool to create a structured list of tasks. For each identified callsite, a unique `todowrite` entry is generated. This approach makes partial progress visible and prevents any callsite from being silently skipped or forgotten during the migration process. These entries serve as a living checklist within your terminal, allowing you to see exactly which files and lines still require attention. This granular task management is particularly valuable for large MATLAB codebases where a single deprecated function might have widespread usage, ensuring a systematic and complete transition.

Applying changes and running MATLAB tests automatically

Atlas automates the application of migration patches and immediately validates changes by running `matlab.unittest (runtests)`. This ensures that each of the 5-10 changes applied per session is correct and does not introduce regressions, providing instant feedback on the health of your MATLAB codebase.

For each `todowrite` entry, Atlas proceeds to migrate the callsite using the `apply_patch` tool. This tool is designed for safety and precision: it seeks the exact hunk's context and `old_lines` before applying the change. If the expected lines are not found due to file drift or prior manual edits, `apply_patch` throws a 'Failed to find expected lines' error rather than guessing, preventing erroneous modifications. Immediately after a file is modified, Atlas uses the `bash` tool to execute the affected tests with `matlab.unittest (runtests)`. This tight feedback loop ensures that any introduced regressions are caught instantly. Only once the tests pass for a specific file is its corresponding `todowrite` entry marked as completed, guaranteeing that each migration step is functionally verified.

Ensuring complete MATLAB API deprecation and cleanup

After migrating all identified callsites, Atlas performs a final verification step to confirm zero remaining usages of the deprecated MATLAB API. This crucial check, typically taking less than 1 minute, ensures a clean removal and prepares your codebase for the deletion of the old implementation.

The migration workflow concludes with a final, comprehensive verification to ensure the deprecated MATLAB API has been entirely removed from the codebase. Atlas performs a final `grep` search for the deprecated symbol across all .m files. This step acts as a double-check, catching any obscure or dynamically referenced instances that might have been missed in earlier stages. Confirming zero remaining hits is the definitive signal that the migration is complete. Only then does Atlas prompt for the deletion of the old implementation, ensuring a clean and thorough deprecation. Additionally, Atlas can apply `MATLAB Format Code` conventions to all touched files before final approval, maintaining code consistency.

Safe and transparent MATLAB code modifications with Atlas

Atlas prioritizes safety and transparency throughout the MATLAB API migration process, offering multiple layers of review and control. Every proposed change, from a single line edit to a 20-file refactor, is presented as a unified diff for your explicit approval before being written to disk.

Atlas is built with safety and developer control at its core. Before any tool call is executed, it is permission-gated against `allow`, `ask`, and `deny` rules, giving you explicit control over its actions. Atlas drafts a detailed plan in a read-only plan agent and asks for your approval before switching to a build agent to make changes. Crucially, for every file edit, Atlas computes a unified diff and surfaces it for your approval. This allows you to review the exact changes line-by-line, ensuring that the modifications align with your expectations and do not introduce unintended side effects. Atlas also snapshots file changes as git patches, enabling easy diffing and rollback of edits if necessary, providing a robust safety net for your MATLAB codebase.

Step by step

  1. 01Run Atlas in your MATLAB project directory containing .m files and any `buildfile.m`.
  2. 02Ask Atlas to enumerate all callsites of the deprecated symbol using `lsp findReferences` and cross-check with `grep` for dynamic usages.
  3. 03Review the list of identified callsites and confirm the scope of the migration.
  4. 04Instruct Atlas to create `todowrite` entries for each callsite to track progress.
  5. 05Approve Atlas's plan to migrate each callsite using `apply_patch`, ensuring context-anchored changes.
  6. 06For each file modified, Atlas will run `matlab.unittest (runtests)` to verify changes; approve only if tests pass.
  7. 07Allow Atlas to apply `MATLAB Format Code` conventions to touched files for consistency.
  8. 08After all callsites are migrated, ask Atlas to `grep` for the deprecated symbol to confirm zero remaining hits.
  9. 09Approve the deletion of the old deprecated API implementation.

Frequently asked questions

How does Atlas ensure it finds all deprecated function calls in MATLAB, even dynamic ones?
Atlas combines `lsp findReferences` for static, syntax-aware identification of calls in .m files, classdef blocks, and `matlab.unittest` classes, with a `grep` search to catch dynamic or string-based usages like those within `eval` or `feval` calls, ensuring a complete enumeration.
Can I review changes before Atlas writes them to my MATLAB files?
Yes, Atlas provides a unified diff for every file edit and surfaces it for your explicit approval before writing any changes. This allows for a thorough review of all proposed modifications to your MATLAB code.
How does Atlas handle testing during a MATLAB API migration?
After each file modification, Atlas uses the `bash` tool to run affected tests with `matlab.unittest (runtests)`. A `todowrite` entry is only marked complete once its associated tests pass, ensuring functional correctness at every step.
What if a MATLAB file has changed since Atlas identified a callsite?
Atlas's `apply_patch` tool is designed to prevent misapplication. It requires the exact context and `old_lines` to match before applying a patch. If the file has drifted, it will report 'Failed to find expected lines' rather than making an incorrect change.
Does Atlas integrate with MATLAB's code formatting standards?
Yes, Atlas can apply the `MATLAB Format Code` conventions to any files it touches during the migration process, ensuring that your codebase remains consistent and adheres to established style guidelines before you approve the changes.
Is Atlas suitable for large MATLAB codebases with many deprecated API calls?
Absolutely. The `todowrite` system is specifically designed for workflows that 'punish half-measures,' making it ideal for large-scale migrations. It provides clear visibility into partial progress and ensures no callsite is overlooked, even across hundreds of .m files.

Try Atlas in your terminal

The terminal-native AI coding agent. Free core, single binary.

Install Atlas

Related guides

Migrate a Deprecated API Across Every Callsite with Atlas (2026 Workflow)

How to migrate a deprecated API across every callsite with Atlas in 2026: the lsp tool's findReferences enumerates callers, todowrite tracks them, apply_patch migrates each one.

Audit a repo with parallel subagents in MATLAB with Atlas in 2026

Sweep your MATLAB repository for issues without context window limits. Atlas uses parallel subagents to audit .m files, classdef blocks, and matlab.unittest test classes efficiently.

Rename a symbol across the repo in MATLAB with Atlas in 2026

In 2026, Atlas empowers MATLAB developers to rename functions, classes, and constants across their repositories with unparalleled precision. Leverage semantic analysis and robust verification for comprehensive, safe

Upgrade a dependency and fix the breakage in MATLAB with Atlas in 2026

In 2026, Atlas helps MATLAB developers upgrade dependencies and fix breaking changes. Automate MATLAB Add-On Manager (mpm) updates, repair compile errors, and resolve matlab.unittest failures with AI-driven precision.

Document a module with a README in MATLAB with Atlas in 2026

Learn how Atlas helps MATLAB developers in 2026 generate accurate README documentation directly from source code, using `matlab.unittest (runtests)` and `MATLAB Add-On Manager (mpm)`.

Write unit tests for untested code in MATLAB with Atlas in 2026

Add real unit tests to your MATLAB code in 2026 using Atlas. Learn how Atlas leverages matlab.unittest (runtests) and existing repo conventions for robust testing.

Plan a Multi-File Change Before Editing in MATLAB with Atlas in 2026

Design complex, multi-file MATLAB changes and get them reviewed before modifying a single line of code using Atlas's dedicated plan agent and integrated toolchain.

Run Atlas Headless in CI for MATLAB Projects in 2026

Automate Atlas in your MATLAB CI/CD pipelines. Get machine-readable output, pre-approve tools, and integrate with matlab.unittest and MATLAB Format Code for efficient, non-interactive code generation and review.

Browse this resource hub