The attached files illustrate the method to use this functionality. Please execute the following steps:
1. Download the attached three files and store it in a location in your MATLAB path (exampleW.mdl, CreateIC.m, & BusObject.mat).
2. Run the 'CreateIC.m' file. This creates a bus object with required signals in the base workspace and the MATLAB structure with initial condition using the command 'Simulink.Bus.createMATLABStruct'.
3. Now run the model and observe the scope. You will see that the initial conditions that are set in the 'CreateIC' MATLAB script takes effect.
Also please note that to use Bus initial condtions you will need to satisfy the following two validity checks:
1. Strict bus modeling: To enable this diagnostic, set the 'Mux blocks used to create bus signals' option to 'error' in Configuration Parameters Dialog -> Diagnostics -> Connectivity.
2. Underspecified initialization detection: To enable this diagnostic, set the 'Underspecified initialization detection' to 'Simplified' in Configuration Parameters Dialog -> Diagnostics -> Data Validity -> Model Initialization
Best Answer