MATLAB
Avoid common MATLAB mistakes — indexing traps, matrix vs element-wise ops, and vectorization pitfalls.
MIT-0 · Free to use, modify, and redistribute. No attribution required.
⭐ 2 · 664 · 2 current installs · 2 all-time installs
byIván@ivangdavila
MIT-0
Security Scan
OpenClaw
Benign
high confidencePurpose & Capability
Name/description match the SKILL.md content (MATLAB pitfalls). Declaring the matlab binary requirement is proportionate and expected.
Instruction Scope
SKILL.md is static guidance (indexing, operators, debugging tips). It does not instruct the agent to read unrelated files, access environment variables, or transmit data externally.
Install Mechanism
No install spec or external downloads; instruction-only skills have minimal disk/write risk.
Credentials
No environment variables, credentials, or config paths are requested — nothing disproportionate is asked for.
Persistence & Privilege
always is false and the skill is user-invocable. Allowing autonomous invocation is the platform default and acceptable given the skill's limited scope.
Assessment
This skill is a read-only MATLAB tipsheet and does not request secrets or perform installations. It will only be useful if you have the matlab binary available. Because the skill’s source is unknown, consider: (1) only enable it if you trust the registry publisher or prefer local documentation; (2) confirm you want an agent to be able to call it autonomously (it’s low-risk but will run if invoked); and (3) if you need reproduction from a vetted source, consult official MathWorks documentation instead.Like a lobster shell, security has layers — review code before you run it.
Current versionv1.0.0
Download ziplatest
License
MIT-0
Free to use, modify, and redistribute. No attribution required.
Runtime requirements
📐 Clawdis
OSLinux · macOS · Windows
Binsmatlab
SKILL.md
Indexing
- 1-based indexing — first element is
A(1), notA(0) endkeyword for last index —A(end),A(end-1), works in any dimension- Linear indexing on matrices —
A(5)accesses 5th element column-major order - Logical indexing returns vector —
A(A > 0)gives 1D result regardless of A's shape
Matrix vs Element-wise
*is matrix multiplication —.*for element-wise/solvesA*x = B—./for element-wise division^is matrix power —.^for element-wise power- Forgetting the dot is silent bug — dimensions might accidentally match
Vector Shape Matters
- Row vector:
[1 2 3]or[1, 2, 3]— shape is 1×3 - Column vector:
[1; 2; 3]— shape is 3×1 - Transpose with
'(conjugate) or.'(non-conjugate) — for complex, they differ *between row and column gives scalar or matrix — depending on order
Array Preallocation
- Growing arrays in loops is slow — preallocate:
A = zeros(1000, 1) zeros,ones,nanfor preallocation — specify size upfront- Cell arrays:
cell(n, m)— preallocate cells too
Broadcasting
- Implicit expansion since R2016b —
A + bworks if dimensions compatible - Singleton dimensions expand —
[1;2;3] + [10 20]gives 3×2 - Before R2016b needed
bsxfun— legacy code may still use it
NaN Handling
NaN ~= NaNis true — useisnan()to check- Most operations propagate NaN —
sum([1 NaN 3])is NaN - Use
'omitnan'flag —sum(A, 'omitnan'),mean(A, 'omitnan')
Cell Arrays vs Matrices
{}for cell arrays — hold mixed types, different sizes()indexing returns cell —C(1)is 1×1 cell{}indexing extracts content —C{1}is the actual value- Comma-separated list from
C{:}— useful for function arguments
Common Mistakes
=for assignment,==for comparison —if x = 5is error in MATLAB- Semicolon suppresses output — forget it and flood command window
clearremoves all variables — useclearvarsfor selective,close allfor figuresiandjare imaginary unit — don't use as loop variables, or reassign explicitly- String vs char:
"text"vs'text'— double quotes are string arrays (R2017a+)
Functions
- Anonymous functions:
f = @(x) x^2— quick inline functions - Multiple outputs:
[a, b] = func()— must capture or use~to ignore nargin/nargoutfor optional args — check how many inputs/outputs providedvarargin/varargoutfor variable args — cell array of extra arguments
Debugging
dbstop if error— breakpoint on any errorkeyboardin code pauses execution — enter debug mode at that linewhosshows variable sizes —size(A)for specific variable
Files
1 totalSelect a file
Select a file to preview.
Comments
Loading comments…
