使用.m脚本如何更新​simulink的C​Caller的Ava​ilable Functions — List of available functions

5 ビュー (過去 30 日間)
he
he 2024 年 6 月 13 日
回答済み: Anushka 2025 年 6 月 17 日
想要使用.m脚本,在更新了原代码后,直接更新ccaller的Available Functions。paramters无法调用这个按键。

回答 (1 件)

Anushka
Anushka 2025 年 6 月 17 日
Hi @he,
The 'C Caller block' is specifically designed to interface with 'C code', not 'MATLAB.m' scripts.
The ‘refresh button’ you are referring to only works when the 'C Caller block' is connected to a valid 'C header file (.h)' that declares the available functions. If you are using a '.m' file (MATLAB script or function), it won’t appear in the available functions list and the button will be disabled.
Depending on the type of code you are working with, you can follow the below given steps:
1. If you are working with '.m' code:
  • Do not use the 'C Caller block'.
  • Use the 'MATLAB Function block' instead. It is made to support MATLAB code and automatically updates when the '.m' file changes.
2. If you're working with C code:
  • Ensure your '.c' and '.h' files are correctly added under:
Model Settings > Code Generation > Custom Code
  • Make sure your function is properly declared in the header file.
  • Then the refresh button will work and list the available functions.
You can refer to the following documentation to get a better understanding of 'C Caller block': https://in.mathworks.com/help/simulink/slref/ccaller.html
Hope this helps!

カテゴリ

Help Center および File ExchangeModeling についてさらに検索

製品


リリース

R2021a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by