フィルターのクリア

Is there a way to save a value to .mat file in simevents?

1 回表示 (過去 30 日間)
Ho Jung Kim
Ho Jung Kim 2022 年 8 月 1 日
回答済み: Shuba Nandini 2023 年 9 月 7 日
I am trying to save a value from my simevents model to .mat file. I am using 'save' to save variable to .mat file (for ex, save fileName.mat variableName), but I am getting this error:
Function 'save' not supported for code generation.
When I add coder.extrinsic('save') and run the code, I get this error:
The coder.extrinsic directive cannot be applied to 'save'. Remove the call to coder.extrinsic for this function.
Is there a way to make this work? Thank you.

回答 (1 件)

Shuba Nandini
Shuba Nandini 2023 年 9 月 7 日
Hello,
I understand you want to save the data into a MAT file from SimEvents model. Unfortunately, the “save” command is not supported for code generation. You can use file I/O function that is supported for code generation. You can use fwrite()” function for binary files, and fprintf” function for text files to load the data into .mat file.
Please refer to the following documentation links to know more about “fwrite” and “fprintf” functions:
Hope this helps!
Regards,
Shuba Nandini

カテゴリ

Help Center および File ExchangeDiscrete-Event Simulation についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by