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
累計下載
3663
星標
3
全站排名
#2,959
全站前 59% · 「開發程式設計」前 67%
平台累計安裝累計下載星標評論
ClawHub ↗5318513-
SkillHub ↗34436633—

各平台的計數口徑不同,統計時間不一致。

這個技能是做什麼的

涵蓋矩陣與逐元素運算、向量方向、預分配、擴充套件、缺失值、元胞、函式和除錯。技能本身是指導資料而非可執行程式碼。建議需匹配專案 MATLAB 版本與工具箱,執行或驗證程式碼前確認已安裝且有許可的 MATLAB 環境。

資料釋出於 2026-10-27

可以用來做什麼

  • 審閱 MATLAB 陣列與數值程式碼

什麼時候用

  • MATLAB 片段需要語法或形狀檢查時

示例提示詞

以下是根據技能文件生成的示例,不代表實際執行結果。

檢查這段 MATLAB 的索引、逐元素運算與陣列形狀,列出需在有許可目標環境執行的驗證。

月度資料趨勢

累計下載3663
939240238652026-03 · 累計下載 11412026-05 · 累計下載 17692026-06 · 累計下載 19672026-07 · 累計下載 22792026-08 · 累計下載 26362026-09 · 累計下載 366326-0326-09
星標3
2342026-03 · 星標 32026-05 · 星標 32026-06 · 星標 32026-07 · 星標 32026-08 · 星標 32026-09 · 星標 326-0326-09

2026-09 起統計方法調整:同名技能按作者分別統計,並覆蓋全部技能。圖中虛線為調整前的月份,與之後的資料不直接比較,也不計算跨越調整的增長。

月份累計下載環比星標
2026-093663—3
2026-082636+15.7%3
2026-072279+15.9%3
2026-061967+11.2%3
2026-051769—3
2026-031141—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),按月更新。口徑說明見資料方法。