I have a variable in the workspace Bus type

4 views (last 30 days)
Fernando  Beltrán
Fernando Beltrán on 20 Sep 2016
Answered: BhaTTa on 27 Aug 2024
Goodnight, I have a doubt. I have a variable in the workspace Bus type called "out1" which is formed by three signals. I would like to access each of the variables from Matlab, but not the command that I use. Could anyone help me? Thank you very much

Answers (1)

BhaTTa
BhaTTa on 27 Aug 2024
If you have a bus object in MATLAB called out1 that contains multiple signals, you can access each of the signals using dot notation. Here’s a step-by-step guide on how to do this:Accessing Signals from a Bus
  1. Ensure the Bus Object is Loaded: Before accessing the signals, make sure that the bus object out1 is loaded in the workspace. If it's part of a Simulink model, run the simulation or load the data into the workspace.
  2. Accessing Signals: If out1 is a bus object, you can access its signals using dot notation. Here's how you can do it:
% Assuming 'out1' is your bus object
signal1 = out1.signalName1;
signal2 = out1.signalName2;
signal3 = out1.signalName3;
Replace signalName1, signalName2, and signalName3 with the actual names of the signals within the bus.
Please refer to below documentation for working with a Simulink.Bus object:

Community Treasure Hunt

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

Start Hunting!