フィルターのクリア

Problem with C-Caller

10 ビュー (過去 30 日間)
paolo dini
paolo dini 2023 年 8 月 1 日
コメント済み: paolo dini 2023 年 8 月 11 日
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.

回答 (1 件)

David Balbuena
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:
  1 件のコメント
paolo dini
paolo dini 2023 年 8 月 11 日
Dear David,
first of all, thanks to spent some of your time to check for my issue.
Actually the problem was the extension of the "file.C", as you can notice, what i have uploaded is a "file.C.txt", wich is not recognised as C file from my file system.
I solved forced the extension from terminal (cmd).
I know was a stupid issue after all.
Thanks again!!
Best,
Pierpaolo.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeProgrammatic Model Editing についてさらに検索

製品


リリース

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by