主要内容

金宝appSimulink.SimulationData.forEachTimeseries

调用函数timeseries对象

描述

例子

dataResults = 金宝appSimulink.SimulationData.forEachTimeseries (functionHandleinputData在所有MATLAB上运行指定的功能句柄®timeseries中包含的对象inputData

例子

全部折叠

这个例子展示了如何使用forEachTimeseries函数来运行最小值函数在每个timeseries对象的日志数据中的COUNTERBUS信号。

打开模型并进行模拟。

open_system (“sldemo_mdlref_bus”) sim卡(“sldemo_mdlref_bus”);

访问信号测井数据。对于该模型,数据存储在填充变量。

填充
金宝appSimulink.SimulationData.Dataset topOut BlockPath 4个元素名称  ____________ ________________________________________ 1 [1 x1信号]COUNTERBUS sldemo_mdlref_bus /连接2 [1 x1信号]OUTERDATA sldemo_mdlref_bus / CounterA 3 [1 x1信号]INCREMENTBUS sldemo_mdlref_bus / IncrementBusCreator 4 [1 x1信号]INNERDATA……erA|sldemo_mdlref_counter_bus/COUNTER -使用大括号{}访问、修改或使用索引添加元素。

的值COUNTERBUS元素。

counterbusData = topOut{1}。值
counterbusData = 2×1结构数组的字段:数据限制

运行最小值功能上的counterbus数据。

ret = 金宝appSimulink.SimulationData.forEachTimeseries (@min counterbusData)
Ret = 2x1带有字段的结构数组:数据限制

探索返回的数据。

ret (1)
Ans = data: 0 limit: [1x1 struct]
ret (2) .limits
ANS = UPPER_SATOURATION_LIMIT:40 downer_satorion_limit:0

输入参数

全部折叠

运行的功能timeseries对象,指定为函数句柄。有关指定函数句柄的信息,请参见将一个函数传递给另一个函数

你使用的函数forEachTimeseries

  • 可以是内置函数或用户指定的函数

  • 必须返回标量

如果你使用的函数forEachTimeseries需要:

  • 一个参数,指定函数句柄和输入数据。例如:

    ret = 金宝appSimulink.SimulationData.forEachTimeseries (@min、数据);
  • 不止一个参数,指定函数句柄@ (x)然后指定函数,使用x作为第一个论点。对于剩下的参数,指定值。例如,该命令运行重新取样在MATLAB函数timeseries对象,用于时间向量(2.5 - 3)

    ret = 金宝appSimulink.SimulationData.forEachTimeseries (@ (x)...(重组(X,[2.5 3])),数据);

要运行指定函数的数据,指定为timeseries数据。

输出参数

全部折叠

运行指定函数所产生的数据,使用输入数据的格式和层次结构返回。

相关链接

MATLABtimeseries函数处理

介绍了R2016b