Problem with C-Caller
11 次查看(过去 30 天)
显示 更早的评论
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 个评论
回答(1 个)
David Balbuena
2023-8-10
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:
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Configure and View Diagnostics 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!