I have an Problem with implementing a Matlab Code into Octave. i have an dt = char of the size 5x21
.
dt =
yearmonthdayt [hh:mm]
2016Jan 01 00:00
2016Jan 01 00:15
2016Jan 01 00:30
2016Jan 01 00:45
>> and use
datenum( dt, 'yyyymmmddHH:MM' );
but i get the following error message in Octave:
error: datevec: DATE not parsed correctly with given Format
error: called from datevec at line 147 column 11 datenum at line 104 column 40

댓글 수: 5

Stephen23
Stephen23 2017년 11월 13일
@FishermanJack: if you have Octave problems then you should ask on an Octave forum.
Rik
Rik 2017년 11월 13일
Sadly, there isn't such a forum for Octave (or none that I can find). I would suspect this wouldn't run correctly in Matlab either, as that first line doesn't fit the format.
FishermanJack
FishermanJack 2017년 11월 13일
as Rik said, neither i know a Forum for Octave, because of that i think i could ask someone here. if the question is not suitable for this Forum i will delete it.
dpb
dpb 2017년 11월 13일
Octave isn't Matlab despite it being similar and mostly syntax-similar.
While is OT here, from the error message I'd guess the problem is the format string isn't correct case for the month/hour/day fields...there's a difference between the old datenum and the new(er) datetime in who's upper- and who's lower- case; check the doc for "who's who in the zoo"...
Walter Roberson
Walter Roberson 2017년 11월 13일
The first entry is not parseable. The second others might have problems because of the spaces.

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

 채택된 답변

Jan
Jan 2017년 11월 13일
편집: Jan 2017년 11월 13일

0 개 추천

The first line 'yearmonthdayt [hh:mm]' cannot be parsed correctly. Try this:
datenum(cellstr(dt(2:end, :), 'yyyymmmddHH:MM')
Or do you have to consider the spaces?
datenum(cellstr(dt(2:end, :), 'yyyymmm dd HH:MM')

댓글 수: 1

FishermanJack
FishermanJack 2017년 11월 13일
The first suggestion worked fine, but the main reason was that i had to download the latest version of Octave.

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

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Octave에 대해 자세히 알아보기

질문:

2017년 11월 13일

댓글:

2017년 11월 13일

Community Treasure Hunt

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

Start Hunting!

Translated by