- You can use “fileread” to scan the contents of the headers.
- You can make a regular expression and use string matching operations to extract all the function-call data. Those parenthesis ‘()’ will help you identify function call statements.
Matlab code to extract the function name and parameter list from a C function call
4 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Aasish Valappilekandi
el 24 de En. de 2023
Respondida: Varun
el 24 de Mzo. de 2023
I have many C header files that have few function calls, with arguments and a return type , I would like to automatically process them and generate SFunctionName and OutputFcnSpec required for S Function generation defintion.
For example in Header file function looks like this
uint16 filterV1(uint8 signal, uint16 constant);
[def.SFunctionName = 'GenfilterV1'; and
def.OutputFcnSpec = 'uint16 y1 = filterV1(uint8 u1, uint16 u2)';
Arguments naming should follow "Legacy Code Tool Function Specification rules")
0 comentarios
Respuesta aceptada
Varun
el 24 de Mzo. de 2023
Hello!
As per my understanding, you want to scan your C header files and you want to extract data regarding the function calls present in them. For this,
You may refer to the following documentation for:
Regular expressions: https://www.mathworks.com/help/matlab/ref/regexp.html
0 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre MATLAB Coder en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!