Bus Signal Initialization Error

4 views (last 30 days)
Ahmed Gad
Ahmed Gad on 8 Jun 2022
Answered: Vidhi Agarwal on 4 Nov 2024 at 3:42
I try to initialize simulink signal which data type is Bus Object. After many trials I filled the "initvalue" field with struct('field', value, 'field', value) syntax with real values and fields. But it give me error while simulation which is "Signal object currently cannot support initial value on bus signal". I use matlab 2018b.

Answers (1)

Vidhi Agarwal
Vidhi Agarwal on 4 Nov 2024 at 3:42
I understand you are facing issue in initializing simulink signal. Below are the steps that may help you in resolving the issue.
  • Use a Constant Block: Instead of initializing the signal directly, use a Constant block in your model to set the initial values for the bus signal. Configure the Constant block to output a bus signal by specifying the bus object as its data type.
  • Initialize in a MATLAB Function Block: You can initialize the bus signal within a MATLAB Function block. This block can output the required bus structure, and you can set its initial values programmatically.
  • Use the Bus Assignment Block: If you need to set only specific fields of the bus, you can use a Bus Assignment block to assign initial values to certain fields of the bus signal.
You can also consider upgrading to a newer version of MATLAB.
Hope that helps!

Tags

Community Treasure Hunt

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

Start Hunting!