etime input arguments, what do they mean?

Hi
I am using etime for a piece of code:
start=clock
limit=10
while etime(clock,start) < limit
rotate(xxxx)
end
I am rotating something. My question is though, seeing as we have start=clock i.e. they are equivalent, I am assuming elapsed time is 0, and that while elapsed time = 0 < limit, the rotation will take place?
Have I understood this correctly?
Thanks.

 采纳的回答

Jan
Jan 2022-2-20
编辑:Jan 2022-2-21
Take a look into the documentation:
doc clock
doc etime
Then run some own tests: type this in the command window:
clock
% wait a little bit
clock
You see, clock replies the current time and date as a [1 x 6] vector.
According to the help text, etime replies the number of seconds between two date/time vectors.
The line "start=clock" stores the output of the function clock in the variable start. Comparing the output of the next call of clock with the value of start replies the elapsed time.
In the shown code this means, that the loop runs, until 10 seconds have past.
See this online tutorial to learn the basics: https://www.mathworks.com/learn/tutorials/matlab-onramp.html

更多回答(0 个)

类别

帮助中心File Exchange 中查找有关 Aerospace Blockset 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by