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
41 次查看(过去 30 天)
显示 更早的评论
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
0 个评论
回答(2 个)
Marcelo
2020-2-7
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
0 个评论
Sara Nadeau
2020-2-7
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!
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Load Signal Data for Simulation 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!