How to pass a string parameter to a Simulink S-function using the S-Function Builder
显示 更早的评论
Hi all,
I've created a Simulink S function that calls a DLL file containing the model functions in C using the S-Function Builder in Simulink 2021a
However, during the initialization of this model, I need to pass a string that points to a JSON file containing all the model parameters. Currently, I've hard-coded the file path for testing, and it works. However, I would like to be able to pass this as a parameter.
// TODO: make params_file_path a parameter
const char* params_file_path = "default_parameters.json";
params = load_parameters(params_file_path);
When I click on the parameter data types in the S-Function Builder, I see options for double, single, int8, int16, int32, uint8, uint16, uint32, and boolean, but I do not see an option for strings or characters.
I assume that I will need to manually modify the autogenerated wrapper.c file, but I would appreciate some guidance on how to do this.
Regards,
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Configure C/C++ S-Function Features 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
