Iván

MATLAB

开发编程v1.0.0
作者:Iván更新于 2026-05-11matlab@clawhub_ivangdavila/matlab
Bug 修复

据 AlphaMoat 统计,截至 2026-09,MATLAB 累计下载 3,663 次、获 3 个星标,在全部 5,078 个 AI 技能中排名第 2,959 位,在「开发编程」分类(577 个)中排名第 385 位。

累计安装
344
累计下载
3,663
星标
3
全站排名
#2,959
全站前 59% · 「开发编程」前 67%
平台累计安装累计下载星标评论
ClawHub ↗531,8513-
SkillHub ↗3443,6633—

各平台的计数口径不同,统计时间不一致。

这个技能是做什么的

涵盖矩阵与逐元素运算、向量方向、预分配、扩展、缺失值、元胞、函数和调试。技能本身是指导资料而非可执行代码。建议需匹配项目 MATLAB 版本与工具箱,运行或验证代码前确认已安装且有许可的 MATLAB 环境。

资料发布于 2026-10-27

可以用来做什么

  • 审阅 MATLAB 数组与数值代码

什么时候用

  • MATLAB 片段需要语法或形状检查时

示例提示词

以下是根据技能文档生成的示例,不代表实际运行结果。

检查这段 MATLAB 的索引、逐元素运算与数组形状,列出需在有许可目标环境执行的验证。

月度数据趋势

累计下载3,663
9392,4023,8652026-03 · 累计下载 1,1412026-05 · 累计下载 1,7692026-06 · 累计下载 1,9672026-07 · 累计下载 2,2792026-08 · 累计下载 2,6362026-09 · 累计下载 3,66326-0326-09
星标3
2342026-03 · 星标 32026-05 · 星标 32026-06 · 星标 32026-07 · 星标 32026-08 · 星标 32026-09 · 星标 326-0326-09

2026-09 起统计方法调整:同名技能按作者分别统计,并覆盖全部技能。图中虚线为调整前的月份,与之后的数据不直接比较,也不计算跨越调整的增长。

月份累计下载环比星标
2026-093,663—3
2026-082,636+15.7%3
2026-072,279+15.9%3
2026-061,967+11.2%3
2026-051,769—3
2026-031,141—3

SKILL.md 原文

以下是作者发布的原始文件,按纯文本显示,本站未做修改或审核;其中的链接不可点击,命令请核实后再运行。抓取于 2026-10-23。

2.9 KB · ClawHub v1.0.0
---
name: MATLAB
description: Avoid common MATLAB mistakes — indexing traps, matrix vs element-wise ops, and vectorization pitfalls.
metadata: {"clawdbot":{"emoji":"📐","requires":{"bins":["matlab"]},"os":["linux","darwin","win32"]}}
---

## Indexing
- 1-based indexing — first element is `A(1)`, not `A(0)`
- `end` keyword for last index — `A(end)`, `A(end-1)`, works in any dimension
- Linear indexing on matrices — `A(5)` accesses 5th element column-major order
展开全部(共 63 行)
- 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
- `/` solves `A*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`, `nan` for preallocation — specify size upfront
- Cell arrays: `cell(n, m)` — preallocate cells too

## Broadcasting
- Implicit expansion since R2016b — `A + b` works 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 ~= NaN` is true — use `isnan()` 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 = 5` is error in MATLAB
- Semicolon suppresses output — forget it and flood command window
- `clear` removes all variables — use `clearvars` for selective, `close all` for figures
- `i` and `j` are 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`/`nargout` for optional args — check how many inputs/outputs provided
- `varargin`/`varargout` for variable args — cell array of extra arguments

## Debugging
- `dbstop if error` — breakpoint on any error
- `keyboard` in code pauses execution — enter debug mode at that line
- `whos` shows variable sizes — `size(A)` for specific variable

「开发编程」分类下的热门技能

Iván 的其他技能

数据月份:2026-09 · 下载/星标/安装数聚合自公开技能注册库(ClawHub、SkillHub),按月更新。口径说明见数据方法。