How to get Claude to write idiomatic MATLAB, not MATLAB-flavored Python
언제 쓸까: Any MATLAB authoring task — from scripts to toolboxes.
사전 조건
- MATLAB R2023b+ recommended — mathworks.com/products/matlab.html
- Skill cloned — git clone https://github.com/matlab/skills ~/.claude/skills/skills
흐름
-
Describe the taskWrite a function that computes the moving-window correlation of two time series — MATLAB, idiomatic.✓ 복사됨→ Vectorized implementation, correct function signature, docstring
-
Ask for testsAdd MATLAB unit tests using matlab.unittest.✓ 복사됨→ Tests in a separate file following MATLAB Test conventions
-
ProfileIf this is called in a tight loop, how would you profile and speed it up?✓ 복사됨→ tic/toc or profile() suggestions, preallocation hints
결과: Idiomatic, fast, tested MATLAB code.
함정
- Claude reaches for Python-style loops — Explicitly ask for vectorized form; reference MATLAB docs style