필터 지우기
필터 지우기

Convert Minutes to Seconds

조회 수: 21 (최근 30일)
Hadi Hajieghrary
Hadi Hajieghrary 2016년 8월 3일
답변: J. Webster 2016년 8월 3일
Please execute this line of code in Matlab R2015b:
>> [minutes(seconds(1)):minutes(1):minutes(seconds(200))]
Why it goes crazy and gives back a column vector of size 4777?
I need to create ticks for my plot; and I thought this had to work!

채택된 답변

Thorsten
Thorsten 2016년 8월 3일
편집: Thorsten 2016년 8월 3일
The help of minutes tells us
If X is a numeric array, then M is a duration array in units of minutes.
If X is a duration array, then M is a double array with each element equal to the number of minutes in the corresponding element of X.
so
minutes(seconds(1))
and
minutes(seconds(200)
give a double, while
minutes(1)
gives a duration. So you have
<double>:<duration>:<double>
which messes all up. To increment by 1 minute, use
minutes(seconds(1)):minutes(seconds(200))
  댓글 수: 1
Hadi Hajieghrary
Hadi Hajieghrary 2016년 8월 3일
Thank you. This is really confusing. I believe what I tried to do is the one of the most common use of the time types like minutes, second, etc.; and, yet it can not be done!

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

J. Webster
J. Webster 2016년 8월 3일
no idea why it behaves that way.
However, you should check out datetick

카테고리

Help CenterFile Exchange에서 Dates and Time에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by