How can I load Simscape Logging Node data in Python?
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Nicholas Hemenway
am 27 Jun. 2022
Beantwortet: Ninad
am 18 Sep. 2023
I've got a simulation that uses Simscape and exports all of the logged data to a base workspace variable called simscape_data. I'd like to be able to save this to a file that can be loaded and post processed with some python scripts downstream. There's a scipy function (scipy.io.loadmat) that enables you to load .mat files into python but this only works for simple array objects. Is there any way to load more complicated matlab objects (like the simscape.logging.Node object) into python?
0 Kommentare
Akzeptierte Antwort
Ninad
am 18 Sep. 2023
Hi Nicholas,
As per my understanding, you want to know how to save the `simscape.logging.Node` object from matlab and retrieve the same later in Python.
To load more complex MATLAB objects into Python, you can use the `mat73` module from the `scipy.io` package. This module provides support for reading MATLAB files in the newer ‘.mat`’format (MATLAB 7.3 and above), which allows for storing more complex data structures.
To know more about ‘mat73’ module, i suggest you refer the following link:
As ‘simscape.logging.Node’ is a complex object that contains simulation data , it may not be directly serializable to a ‘.mat’ file. But you can surely store the relevant data from the object into an ‘.mat’ file.
Once you have the relevant data in a ‘.mat’ file, you can use the `mat73.loadmat` function to load the data from the ‘.mat’ file.
I hope this addresses your query..
Thanks,
Ninad.
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Call Python from MATLAB finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!