ASP源码
PHP源码
.NET源码
JSP源码
此技能为通过 Openclaw Skills 使用 MATLAB 的开发人员提供全面的知识库。它专注于消除常见的错误,例如索引陷阱和矩阵运算混淆。通过遵循这些指南,开发人员可以确保其代码是向量化的、内存高效的且逻辑严密的。
该技能提供了对 MATLAB 独特的基于 1 的索引系统、矩阵与逐元素算术的关键区别,以及处理元胞数组和字符串数组等不同数据结构的细微差别的深入见解。对于任何想要构建强大的科学计算或数据分析工作流的人来说,这都是一个必不可少的资源。
下载入口:https://github.com/openclaw/skills/tree/main/skills/ivangdavila/matlab
从源直接安装技能的最快方式。
npx clawhub@latest install matlab
将技能文件夹复制到以下位置之一
全局模式~/.openclaw/skills/
工作区
/skills/
优先级:工作区 > 本地 > 内置
将此提示词复制到 OpenClaw 即可自动安装。
请帮我使用 Clawhub 安装 matlab。如果尚未安装 Clawhub,请先安装(npm i -g clawhub)。
要在 Openclaw Skills 中利用此技能,请确保系统路径中提供 MATLAB 二进制文件。此技能支持 Linux、macOS (Darwin) 和 Windows (Win32)。
# 检查是否可以从 CLI 访问 MATLAB
matlab -nodesktop -nosplash -r "version, exit"
确保您的开发环境已配置为使用此技能提供的指南来解释 .m 文件。
该技能将 MATLAB 特有的技术约束组织到以下分类中:
| 类别 | 核心概念 |
|---|---|
| 索引 | 基于 1、线性索引、逻辑索引、'end' 关键字 |
| 运算 | 矩阵与逐元素 (* vs .*), 转置与共轭转置 |
| 内存 | 数组预分配 (zeros, ones, nan), 元胞数组预分配 |
| 数据类型 | 元胞数组 ({}), 字符串 (""), 字符 (''), 双精度 |
| 函数 | 匿名函数, nargin/nargout, varargin/varargout |
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"]}}
A(1), not A(0)end keyword for last index — A(end), A(end-1), works in any dimensionA(5) accesses 5th element column-major orderA(A > 0) gives 1D result regardless of A's shape* is matrix multiplication — .* for element-wise/ solves A*x = B — ./ for element-wise division^ is matrix power — .^ for element-wise power[1 2 3] or [1, 2, 3] — shape is 1×3[1; 2; 3] — shape is 3×1' (conjugate) or .' (non-conjugate) — for complex, they differ* between row and column gives scalar or matrix — depending on orderA = zeros(1000, 1)zeros, ones, nan for preallocation — specify size upfrontcell(n, m) — preallocate cells tooA + b works if dimensions compatible[1;2;3] + [10 20] gives 3×2bsxfun — legacy code may still use itNaN ~= NaN is true — use isnan() to checksum([1 NaN 3]) is NaN'omitnan' flag — sum(A, 'omitnan'), mean(A, 'omitnan'){} 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 valueC{:} — useful for function arguments= for assignment, == for comparison — if x = 5 is error in MATLABclear removes all variables — use clearvars for selective, close all for figuresi and j are imaginary unit — don't use as loop variables, or reassign explicitly"text" vs 'text' — double quotes are string arrays (R2017a+)f = @(x) x^2 — quick inline functions[a, b] = func() — must capture or use ~ to ignorenargin/nargout for optional args — check how many inputs/outputs providedvarargin/varargout for variable args — cell array of extra argumentsdbstop if error — breakpoint on any errorkeyboard in code pauses execution — enter debug mode at that linewhos shows variable sizes — size(A) for specific variable