Borrar filtros
Borrar filtros

No appropriate method, property, or field who for class Simulink.S​imulationD​ata.Datase​t. How to access object or signal variable of class Simulink.S​imulationD​ata.Datase​t class

61 visualizaciones (últimos 30 días)
No appropriate method, property, or field who for class Simulink.SimulationData.Dataset. How to access object or signal variable of class Simulink.SimulationData.Dataset class - MATLAB 2017a and M2014a issue

Respuestas (2)

Marcelo
Marcelo el 7 de Feb. de 2020
About this class, Matlab itself gives the following info:
Simulink.SimulationData.Dataset
Package: Simulink.SimulationData
Characteristics:
Name: 'yout'
Total Elements: 1
Elements:
1 : ''
-Use get or getElement to access elements by index or name.
-Use addElement or setElement to add or modify elements.
Methods, Superclasses
Methods for class Simulink.SimulationData.Dataset:
Dataset concat get getElementNames removeElement
addElement find getElement numElements setElement
So, you can use something like this to get the signals from inside the Dataset element:
>> yout.get(1)
ans =
Simulink.SimulationData.Signal
Package: Simulink.SimulationData
Properties:
Name: ''
PropagatedName: ''
BlockPath: [1x1 Simulink.SimulationData.BlockPath]
PortType: 'inport'
PortIndex: 1
Values: [1x1 timeseries]
Methods, Superclasses
>> yout.get(1).Values
timeseries
Common Properties:
Name: ''
Time: [11x1 double]
TimeInfo: [1x1 tsdata.timemetadata]
Data: [11x1 double]
DataInfo: [1x1 tsdata.datametadata]
More properties, Methods
>> yout.get(1).Values.Data'
ans =
1 1 1 1 1 1 1 1 1 1 1
Or, if your signals have defined names, you can use them to get the signals directly. For example, if one of the signals is called "signal_1":
yout.getElement('signal_1').Values.Data

Sara Nadeau
Sara Nadeau el 7 de Feb. de 2020
If you want to know the names of the elements in the object, you can use the getElementNames function.
If you want to access the data for a specific element, you can use the get or getElement functions. (The get and getElement functions have identical behavior, just a matter of how you want your code to read).
The get and getElement functions support accessing elements by their index within the Dataset object or by name. If you know the index of the element, you can also index into the Dataset object using curly braces. For example:
element1 = dsobj{1};
I hope this information and the linked pages for getElementNames and get help!

Categorías

Más información sobre Load Signal Data for Simulation en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2017a

Community Treasure Hunt

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

Start Hunting!

Translated by