Getting a string to become a signal

10 ビュー (過去 30 日間)
Kevin
Kevin 2012 年 4 月 10 日
回答済み: Anshuman 2024 年 12 月 11 日
So i'm trying the following.
When a user inserts a block into his model, the block will define the inputs of the block mask as a ASAP2 Signal. But, when i try to get a string (the signal name) into the input, the command get_param(gcb, '[insert variable name]') does not work. Instead of defining the string value, it defines "get_param" as an ASAP2 Signal.
Am i using the wrong command for getting the string, or am i overlooking something while using get_param?

回答 (1 件)

Anshuman
Anshuman 2024 年 12 月 11 日
Hello Kevin,
When you use "get_param(gcb, 'ParameterName')" in Simulink to retrieve a parameter value from a block, it should return the current value of that parameter. If you're trying to set the block's parameter value to the result of "get_param", you might encounter issues with how the value is being interpreted or assigned. If you want to set a parameter to a specific string value (e.g., a signal name), use "set_param" instead.
newSignalName = 'signalName';
set_param(blockPath, paramName, newSignalName);
Hope it helps!

カテゴリ

Help Center および File ExchangeLoad Signal Data for Simulation についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by