time
Extract time vector from simulation series
Syntax
Description
Examples
Extract Simulation Time Data for Spring Deformation
Return simulation time data for the deformation of a Translational Spring block.
Open the Mass-Spring-Damper with Controller example model:
openExample('simscape/MassSpringDamperWithControllerExample')
This example model has data logging enabled for the whole model, with the
Workspace variable name parameter set to
simlog_MassSpringDamperWithController
.
Simulate the model for 1 second, to log the simulation data:
paramNameValStruct.StopTime = '1.0'; sim('MassSpringDamperWithController',paramNameValStruct);
Return the simulation time vector for the deformation variable of the
Translational Spring block, Spring
.
x
is the deformation variable name, and series
is the Series
object containing the simulation data for this
variable.
t1 = time(simlog_MassSpringDamperWithController.Spring.x.series)
t1 = 0 0.0072 0.0143 0.0223 0.0323 0.0447 0.0602 0.0799 0.1064 0.1447 0.1833 0.2114 0.2395 0.2776 0.3248 0.3531 0.3814 0.4194 0.4650 0.4940 0.5230 0.5608 0.6056 0.6356 0.6657 0.7033 0.7467 0.7772 0.8077 0.8451 0.8877 0.9263 0.9572 0.9858 1.0000
The t1
vector has 35 values, between 0 and 1, because the
simulation series has 35 time steps and the simulation stop time is 1 second.
Input Arguments
series
— Simulation series
Series
object
Simulation series, specified as a simscape.logging.Series
object.
series
must include a full identifier path to the series,
starting with the workspace log variable name.
Output Arguments
tv
— Times, in seconds, corresponding to time steps in simulation series
row vector
Times, in seconds, corresponding to the time steps in the simulation series, returned as a row vector.
Version History
Introduced in R2010b
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)