clearvars function in simulink function block

3 ビュー (過去 30 日間)
Sania Gul
Sania Gul 2024 年 9 月 9 日
コメント済み: Sania Gul 2024 年 9 月 10 日
The function in a simulink function block calls another function which has an instruction given below:
clearvars -global Downsample DATAPADDING_MSECS SEARCHBUFFER Fs WHOLE_SIGNAL Align_Nfft Window
This function is giving an error:
Function 'clearvars' not supported for code generation.
I have used
coder.extrinsic("clearvars");
But the error persists, what should I do?

採用された回答

Shivam Gothi
Shivam Gothi 2024 年 9 月 9 日
編集済み: Shivam Gothi 2024 年 9 月 9 日
Hello @Sania Gul,
I am not familiar with the specific structure of your Simulink model, but I wanted to share some information from the following documentation
According to it, The code generation is not supported for "extrinsic" functions. The code generator does not produce code for the body of the extrinsic function and instead uses the MATLAB® engine to execute the call.
The line:
coder.extrinsic("function1");
will make "function1" an extrinsic function.
I think that the presence of extrinsic function in your model is not allowing code generation for your simulink model.
You can also refer to the below documentation to know more about extrinsic functions and their uses in MATLAB.
  1 件のコメント
Sania Gul
Sania Gul 2024 年 9 月 10 日
Tnx a lot. :-)

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

その他の回答 (1 件)

Walter Roberson
Walter Roberson 2024 年 9 月 10 日
Compiled models use static allocation for global variables. Asking to clear the global would be asking to release the static memory. This is unlikely to make the memory available for use, as the allocations for dynamic memory would be a different part of the address space.
  1 件のコメント
Sania Gul
Sania Gul 2024 年 9 月 10 日
Ok. What I understand is that deleted the variables declared as global is not possible. Hopefully I m right. TNk u sooooo much, for resolving the confusion.

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

カテゴリ

Help Center および File ExchangeDeployment, Integration, and Supported Hardware についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by