Matlab Codegen Deployのロゴ

Matlab Codegen Deploy

コミュニティ
wzyn20051216
matlab-codegen-deploy

MATLAB code generation and deployment workflow for MATLAB Coder, Simulink Coder, Embedded Coder, GPU Coder, HDL Coder, fixed-point conversion, MEX validation, and embedded deployment readiness. Use whenever the user asks to generate C/C++/CUDA/HDL/code, deploy algorithms, or validate generated code.

概要

公開者wzyn20051216
リポジトリmatlab-agent-skills
スキル名matlab-codegen-deploy
スター
32
フォーク
1
同梱ファイル
4
ライセンスMIT
リンク
  • Markdown形式の指示

    モデルが必要に応じて読み込むSKILL.mdファイルです。関連するリクエストがあったときだけトークンを消費します。

  • どのLLMでも利用可能

    AIスキルはプロバイダー固有のコードではなく、通常のMarkdownなので、GPT、Claude、Gemini、Grok、ローカルモデルで利用できます。

  • 4個の同梱ファイル

    モデルが作業中に読み取れるスクリプト、テンプレート、参考資料です。ファイルは読み取り専用で、実行されることはありません。

  • オープンソース

    wzyn20051216がGitHubで公開しています。インストールする前にソースを確認してください。

インストール

AIスキルMatlab Codegen DeployをTypingMindにインストールすれば、どのLLMでも利用できます。SKILL.mdを読み取れる別のAIエージェントに追加することもできます。

1

TypingMindにインストール

TypingMindはGitHubフォルダから直接スキルをインストールします。SKILL.mdを読み取り、リソースファイルをまとめてローカルに保存します。

  1. アプリを開き、「プラグイン」→「スキル」に移動します。
  2. 「GitHubからインストール」を選択します。
  3. 以下のスキルフォルダのURLを貼り付けて確定します。
    https://github.com/wzyn20051216/matlab-agent-skills/tree/main/skills/matlab-codegen-deploy
  4. スキルを利用したいチャットごとに、そのスキルを有効にしてください。
「プラグイン」→「スキル」→「スキルを追加」→「GitHubのURLから」を選択し、フォルダのURLを貼り付けて「続行」を押します。
2

別のAIエージェントにインストール

Agent Skills形式を読み取れるAIエージェントなら、このスキルを利用できます。フォルダをそのAIエージェントのスキルディレクトリにコピーしてください。

Claude Code — .claude/skills
git clone --depth 1 https://github.com/wzyn20051216/matlab-agent-skills.git /tmp/matlab-agent-skills
mkdir -p .claude/skills
cp -r /tmp/matlab-agent-skills/skills/matlab-codegen-deploy .claude/skills/matlab-codegen-deploy
コピー後、新しいスキルを読み込むためにClaude Codeを再起動してください。

TypingMindで使用

TypingMindのチャットでMatlab Codegen Deployを有効にするだけで、あとはモデルが対応します。名前と説明がシステムプロンプトに含まれ、関連するリクエストがあると、モデルが指示の全文を自動で読み込みます。手動で呼び出す必要はなく、実際に使用されるまでトークンを消費しません。

関連するリクエストがあると、モデルが自動的にMatlab Codegen Deployを読み込みます。

どのAIモデルでも利用可能

AIスキルはプロバイダー固有のコードではなく、通常のMarkdownで書かれた指示です。そのため、Matlab Codegen Deployは作成時に想定されたモデルに縛られません。TypingMindに一度インストールすれば、ご自身のAPIキーを使って、GPT-5、Claude、Gemini、Grok、DeepSeek、Mistral、Llama、またはご自身で実行するローカルモデルで利用できます。

  • 必要なときだけ読み込み

    システムプロンプトには名前と説明だけが含まれます。関連するリクエストが初めてあったときに指示を取得するため、未使用のスキルにはコストがかかりません。

  • チャットの途中でモデルを切り替え

    スキルはコードではなく指示なので、モデルを切り替えてもそのまま使えます。次のモデルも同じSKILL.mdを読み込みます。

スキルの指示

モデルが読み込むSKILL.mdの内容です。スキルはモデルが従う指示なので、インストールする前に確認してください。

MATLAB Codegen Deploy

Use this skill when MATLAB or Simulink algorithms need to become generated code or deployable artifacts.

Skill Root

The installed directory containing this SKILL.md is the resource root. Add its helper folder for the current MATLAB session only — never through savepath, startup.m, or a global path edit:

matlab
skillRoot = '<absolute path to the installed matlab-codegen-deploy Skill directory>';
addpath(fullfile(skillRoot, 'scripts'));

Resolve references/, tests/, and helper calls from that root, not from the caller's working directory. If a shipped helper or reference is missing, report the exact path and reinstall the Skill; do not scan the disk for a substitute.

Workflow

  1. Identify target: MEX, C/C++, embedded C, CUDA, HDL, PLC, or packaged app.
  2. Verify required products with ver and license.
  3. Isolate the algorithm into a codegen-friendly function.
  4. Define input types with coder.typeof or representative test vectors.
  5. Generate the smallest artifact first, usually MEX.
  6. Compare generated result against MATLAB golden output.
  7. Save generated code, logs, reports, and validation metrics.

Self-Compile and Verify Preference

The user expects generated MATLAB/Simulink work to compile and verify itself after writing. Do not stop at source generation when a build or smoke check is feasible:

  1. For MATLAB Coder, run codegen and then compare generated/MEX output against MATLAB golden output when compiler support exists.
  2. For Simulink Coder, update/compile the model first, run simulation, then call slbuild only after simulation passes.
  3. For embedded targets such as STM32, first try the configured hardware target and toolchain; if it fails, capture the exact missing package/compiler message and generate the closest portable C fallback if possible.
  4. Verify generated .c, .h, project, library, elf/axf/hex/bin, or fallback artifacts exist and are nonempty.
  5. Report clearly which stage passed: model update, simulation, code generation, toolchain build, binary generation, or only portable fallback.

MATLAB Coder Pattern

Use this pattern before larger deployment:

matlab
cfg = coder.config("mex");
codegen -config cfg myFunction -args {coder.typeof(0,[100 1],[1 0])}
gold = myFunction(x);
actual = myFunction_mex(x);
assert(norm(gold-actual) < 1e-9)

Embedded Readiness

Check:

  • Fixed-size vs variable-size arrays.
  • Dynamic allocation and recursion.
  • Unsupported functions.
  • Numeric overflow and fixed-point scaling.
  • Stack and heap impact.
  • Timing budget and hardware target assumptions.

Simulink Codegen

For models:

  • Update/compile the model after editing and before slbuild.
  • Build only after simulation passes.
  • Set solver and sample times explicitly.
  • Run Model Advisor or relevant checks when available.
  • Compare simulation outputs before and after code generation.

STM32 Embedded Coder Readiness

For STM32 targets, do not treat "an executable exists on disk" as enough. Verify the full MATLAB-to-ST chain before blaming the model:

  • MATLAB products: Simulink, Simulink Coder, Embedded Coder, STM32 support package.
  • MATLAB registration: stm32cube.hwsetup.stm32Tools.getInstalledSTM32CubeMX() returns the CubeMX directory MATLAB will use.
  • ST tools: GNU Tools for STM32, CMSIS, CMSIS-DSP, STM32CubeMX, and the matching STM32Cube firmware package such as STM32Cube_FW_F1_*.
  • Model binding: the model has a real .ioc path in STM32CubeMX.ProjectFile.
  • Target hardware: codertarget.targethardware.getRegisteredTargetHardwareNames includes the required STM32 family, for example STM32F1xx Based.

Prefer target data APIs over editing opaque structures:

matlab
tools = stm32cube.hwsetup.stm32Tools();
tools.updateSTM32CubeMXPath("<absolute path to the installed STM32CubeMX>");

codertarget.data.setParameterValue(model, "STM32CubeMX.ProjectFile", iocPath);
codertarget.data.setParameterValue(model, "STM32CubeMX.DeviceId", "STM32F103RBTx");
codertarget.data.setParameterValue(model, "STM32CubeMX.Family", "STM32F1");

If slbuild hangs around "Generating code from STM32CubeMX project" or "Starting compilation process":

  • Check STM32CubeMX.log, generated hardware scripts, and background java.exe / STM32CubeMX.exe processes.
  • Compare direct STM32CubeMX.exe -q script with MATLAB's java -jar STM32CubeMX.exe -q script; some CubeMX versions can behave differently.
  • Prefer the MathWorks-recommended CubeMX version shown by message("stm32:setup:CubeMXReqVersion").getString.
  • If non-ASCII paths are involved, copy the model and .ioc to an ASCII scratch path and retry once to isolate path encoding from model errors.
  • Only use a local CubeMX wrapper as a documented workaround after recording the direct failure and the real CubeMX path.

Output

Report target, generated artifact path, report path, golden comparison result, and limitations.

Bundled Verification Tools

These scripts live in scripts/ and are covered by tests/test_codegen.m (11 assertions):

  • mas_codegen_ready(fileOrFcn) — static readiness audit before a build cycle. Reports blockers (eval/input/clear/load/containers, array growth inside a loop) separately from warnings (table/datetime/graphics/heterogeneous cells). Array growth is a blocker only inside a loop; the same x(end+1)=v outside a loop is a warning, so it is a scan, not a regex grep.
  • mas_codegen_verify(fcn, args) — the self-compile step, made honest. It actually runs codegen, builds the MEX, runs both MATLAB and the MEX, and compares, reporting which stage failed (probe|codegen|build|run|compare). Returns SKIP (not PASS) when no compiler is configured. goldenFcn option substitutes a different golden so a mismatch can be exercised on purpose — a harness that can only ever agree has not been shown to detect anything.
  • mas_fixpt_range(fcn, stimuli) — observe output ranges under test stimuli, then measure the cost of a fixed-point representation (fraction length, SQNR, overflow fraction). Ranges are observed, not proven; the stimuli are part of the result. Without Fixed-Point Designer it returns SKIP rather than emulating fi badly with doubles.

Run everything with matlab -batch "test_codegen(true)" from tests/.

同梱ファイル

スキルが読み込まれている間、モデルは必要に応じてこれらを読み取ります。読み取り可能なファイルとして提供され、実行されることはありません。

よくある質問

AIスキル「Matlab Codegen Deploy」では何ができますか?

MATLAB code generation and deployment workflow for MATLAB Coder, Simulink Coder, Embedded Coder, GPU Coder, HDL Coder, fixed-point conversion, MEX validation, and embedded deployment readiness. Use whenever the user asks to generate C/C++/CUDA/HDL/code, deploy algorithms, or validate generated code.

TypingMindでMatlab Codegen Deployを使うメリットは何ですか?

一度インストールすれば、どのモデルでも使えるからです。Matlab Codegen Deployはプロバイダー固有のコードではなく、通常のMarkdownで記述されているため、同じスキルをGPT-5、Claude、Gemini、Grok、ローカルモデルで利用できます。チャットの途中でモデルを切り替えても、そのまま使い続けられます。TypingMindは自分のAPIキーで動作するため、シート単位のサブスクリプションではなく、プロバイダーに直接料金を支払います。スキルとチャットは自分のストレージに保持されます。

TypingMindにMatlab Codegen Deployをインストールするにはどうすればよいですか?

TypingMindで「プラグイン」→「スキル」→「GitHubからインストール」を開き、https://github.com/wzyn20051216/matlab-agent-skills/tree/main/skills/matlab-codegen-deployを貼り付けてください。TypingMindがSKILL.mdを読み込み、関連ファイルをまとめて、チャットごとに有効にできるスキルとしてインストールします。

Matlab Codegen Deployを使えるAIモデルはどれですか?

TypingMindに接続したどのモデルでも利用できます。AIスキルはプロバイダー固有のコードではなく、通常のMarkdownで書かれた指示です。そのため、GPT、Claude、Gemini、Grok、ローカルモデルのいずれも、リクエストが合致したときにこのスキルを読み込めます。

Matlab Codegen Deployは何個のAIモデルで使えますか?

数に制限はありません。スキルに対応したモデルであれば、GPT、Claude、Gemini、Grok、DeepSeek、Mistral、Llamaなど、どのモデルでもMatlab Codegen Deployを利用できます。すべてTypingMind上で、自分のAPIキーを使って利用できます。

AIスキル「Matlab Codegen Deploy」は無料ですか?

はい。wzyn20051216がGitHubでMITライセンスの下で公開しています。支払いが必要なのは、利用したトークンに対する、ご自身が契約するAIプロバイダーへの料金だけです。

AIスキルとは何ですか?

AIスキルは、特定のタスクの実行方法をAIモデルに教える、再利用可能な指示のセットです。オープンなAgent Skills形式に従い、名前と説明を含むSKILL.mdファイルに加え、モデルが必要とするスクリプト、テンプレート、参照ファイルで構成されます。モデルはリクエストがスキルに合致したときだけ指示を読み込むため、インストール済みのスキルも、使うまでは費用がかかりません。

AIスキルは、プラグインやMCPサーバーとどう違いますか?

プラグインやMCPサーバーは、モデルが呼び出せる新しいツールを提供します。ツールとは、どこかで実行され、結果を返すコードです。一方、AIスキルは、タスクへの取り組み方、従うべき手順、望ましい出力の例といった知識や進め方をモデルに伝えます。スキルは通常のMarkdownで記述されているため、サーバー、APIキー、実行環境は不要で、どのモデルでも利用できます。

すべて見る

今すぐ自分専用のAIワークスペースを作成

ニュースレターに登録すると、新機能や今後のプレゼント企画のお知らせが届きます👇