Is there a way of getting the "LoggingName" and "Source Port" of all the Logging Selected Signals directly in Matlab?

7 views (last 30 days)
Hello all,
I have a Simulink model in which there are some Logging Selected Signals. I can manually check the "LoggingName" of all the Logging Selected Signals by opening the Simulink model and then going under Configuration Parameters > Data Import/Export > Signal logging > Configure Signals to Log... (see the image below).
Is there a way of getting the "LoggingName" and "Source Port" of all the Logging Selected Signals directly in Matlab without opening the Simulink Signal Logging Selector?
If I open the Simulink model and manually Log Selected Signal, the name of the signal is stored under "Source Port" but not under "LoggingName". Is there a way of storing the signal name under "LoggingName"?
It would be a great help to me if someone could give me a solution.
Thank you in advance.

Answers (1)

Fangjun Jiang
Fangjun Jiang on 28 Apr 2021
After a simulation, your signal logging data is saved as, e.g. logsout
Run logsout.getElementNames and other API to get the info you need
You need to right click the signal line, select properties, and provide a signal name
  2 Comments
Mohamed Saud Furqan
Mohamed Saud Furqan on 29 Apr 2021
@Fangjun Jiang Thank you for the response. However I want to access the signal logging data before the start of the Simulation.
In order to have a better clarity of the problem, the test case is can be defined as follows:
  • Before the start of simulation, the logging signals are accessed and saved in a list.
  • The saved signal list is then checked for descreipencies (special characters and blank spaces) as a part of simulation precheck.
  • In case of the any descripencies in signal name, the names are corrected programitacally and then the simulation is started.
The reasons for the pre check is that these signals are used for my post processing, which is done programmatically directly after the simulation is finished.
Fangjun Jiang
Fangjun Jiang on 29 Apr 2021
Then do something like this. Use set() to change name in a for-loop after checking names
hLine=find_system('YourModel','FindAll','On','type','line');
index=cell2mat(get(hLine,'DataLogging'))
get(hLine(index),'name')

Sign in to comment.

Categories

Find more on Prepare Model Inputs and Outputs in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!