how to convert character data to double?

Hi all,
i have a char array that has these values below, which i want to get a bouble array of it.
01/04/2016
02/04/2016
03/04/2016
04/04/2016
.... %etc until
20/05/2016
Any help would be appreciated.
Thanks

 Akzeptierte Antwort

madhan ravi
madhan ravi am 3 Nov. 2018
Bearbeitet: madhan ravi am 3 Nov. 2018

0 Stimmen

Use
datenum() or datetime()
Example:
DateString = ['01/04/2016';'02/04/2016';'03/04/2016';'04/04/2016';'20/05/2016'];
formatIn = 'mm/dd/yyyy';
datenum(DateString,formatIn)
datetime(DateString)
Use datetime as suggested by sir Walter

3 Kommentare

Walter Roberson
Walter Roberson am 3 Nov. 2018
However in most cases we now recommend datetime instead of datenum.
madhan ravi
madhan ravi am 3 Nov. 2018
Thank you sir Walter
Lilya
Lilya am 4 Nov. 2018
Thank you so much it works! .. I do have another question I have also the attached figure data that I want to extract the specific rows from it depends on the dates those are represented as the first 8 column in the files.name stract. How can I use that? to get the finale files are from day 1 of April 2016 until 20th of May 2016. thanks for the help :)

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Gefragt:

am 3 Nov. 2018

Kommentiert:

am 4 Nov. 2018

Community Treasure Hunt

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

Start Hunting!

Translated by