Problem with C-Caller
15 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Hello everyone,
i am just traing to use the C-caller, in very simple way actually but i have encauntered issue already for this simple exercse.
I have the following situation. In the same folder a created:
1) "my_functions.c" with the following content:
#include "my_functions.h"
void my_function_1 (int A, float B, double* C){
*C = A*B;}
int my_function_2 (int A, int B){
return A + B;}
2) "my_functions.h" with the following content:
void my_function_1 (int, float, double*);
int my_function_2 (int, int);
(Actually i have tried also with "external" before the functions prototypes, but it does not works).
3) "esempio_c_caller.slx" where i use the C-caller block.
Actually the code i have the follwing message in the diagnostic viewer when compile my code "Parsing Custom Code in model:'esempio_C_caller' successful." and in fact the c-caller adapt it form on the function i select from the mask interface.
The problem is the folowing, calling for example, my_function_2() connecting sin wave blocks (connected with data type conversion block...) and try to plot the sum, the resulting signal is always equal to zero.
Have you some suggestion?
If i forgot something to secting in the configuration, in order to use C code during simulation?
or other things...
Thanks for attention to All in advance!
PS: i use 2018b version in this case, but i have installe also more recent version (2020b + 2022b) so if workaround is change the version, could be not an issue for me.
0 comentarios
Respuestas (1)
David Balbuena
el 10 de Ag. de 2023
Your model runs and produces results on my end. It's possible that the scope is not scaled properly for you to see the output. Try clicking the auto-scale button to see if that changes anything:
Ver también
Categorías
Más información sobre Configure and View Diagnostics 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!