problem in reading datetime
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
HI ALL
I Got a problem in reading string data file, the error is
??? Error using ==> textscan Invalid file identifier. Use fopen to generate a valid file identifier.
and the command which I used is
fid=fopen('ARBY STARL 170310-200514 LT Edited_OBS TIDES 6mins.dat','r','n','ARAB');
s=textscan(fid,'%{dd MMMM yyyy hh:mm}D %f %f','DateLocale','Delimiter',',');
fclose(ARBY STARL 170310-200514 LT Edited_OBS TIDES 6mins);
finally, my data type is
31 May 2012 04:20,02.650
31 May 2012 04:25,02.640
31 May 2012 04:30,02.630
31 May 2012 04:35,02.630
anyone can help?
0 Kommentare
Antworten (1)
dpb
am 21 Jun. 2015
The file wasn't opened successfully as the error says...use the alternate return to find out additional information on why...
[fid,msg]=fopen('ARBY STARL 170310-200514 LT Edited_OBS TIDES 6mins.dat','r','n','ARAB')
and see what the error message is for hints. I note the character code is not in the listed options so while Matlab will not error it will warn and may or may not provide a correct interpretation. I'd suggest unless there's a known reason, simply use the defaults other than for file permission although the most likely cause for fopen to fail is that the file is not located on the path and so simply isn't found. But, I'd still suggest
[fid,msg]=fopen('ARBY STARL 170310-200514 LT Edited_OBS TIDES 6mins.dat','rt')
as first go and check the returned handle is valid before going on to try to read anything 'cuz "it ain't agonna' work" until it is (valid that is).
0 Kommentare
Siehe auch
Kategorien
Mehr zu Oceanography and Hydrology finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!