Assigning simulink.parameter storage class from a function

12 ビュー (過去 30 日間)
aida_p
aida_p 2023 年 3 月 16 日
回答済み: aida_p 2023 年 3 月 16 日
Hi!
I would like to change the storage class of a simulink.parameter type variable (var1) from within a function. The variable is defined in the workspace in a list called my_param_list and looks as shown bellow:
my_param_list = {var1, var2}
function [some_output] = name(some_input)
assignin('base', [my_param_list(1) '.CoderInfo.StorageClass'], 'ExportedGlobal')
end
Thank you!

採用された回答

aida_p
aida_p 2023 年 3 月 16 日
Hi!
I found a solution!
my_param_list_name = {'var1' 'var2'} %extracting first the name of the variable
function [some_output] = name(some_input)
evalin('base', [my_param_list_name{i} '.CoderInfo.StorageClass = "ExportedGlobal"']);
end
Adding the = "ExportedGlobal" assignment into the string seems to have solved the problem

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLogical についてさらに検索

製品


リリース

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by