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

3 visualizaciones (últimos 30 días)
he
he el 13 de Jun. de 2024
Respondida: Anushka el 17 de Jun. de 2025
想要使用.m脚本,在更新了原代码后,直接更新ccaller的Available Functions。paramters无法调用这个按键。

Respuestas (1)

Anushka
Anushka el 17 de Jun. de 2025
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!

Categorías

Más información sobre Modeling en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by