Filter löschen
Filter löschen

Info

Diese Frage ist geschlossen. Öffnen Sie sie erneut, um sie zu bearbeiten oder zu beantworten.

Seperate Matlab data for my text file

1 Ansicht (letzte 30 Tage)
Megan Mirkhanian
Megan Mirkhanian am 20 Jan. 2020
Geschlossen: MATLAB Answer Bot am 20 Aug. 2021
I have data where the year and month are stuck together, as seen 180001, should be 01 1800, how do I seperate that?

Antworten (1)

Bhaskar R
Bhaskar R am 20 Jan. 2020
Bearbeitet: Bhaskar R am 20 Jan. 2020
Suppose your data in the variable data
data_in_time = datetime(num2str(data(:,1)), 'Format', 'yyyyMM');
data_in_time.Format = 'MM-yyyy';
If you want data in double class instead of datetime
data_in_double = datevec(data_in_time);
% then get the repective column accordingly(years/months)
  1 Kommentar
Stephen23
Stephen23 am 20 Jan. 2020
Bearbeitet: Stephen23 am 20 Jan. 2020
Setting the 'Format' option is definitely the way to go, although note that like textscan it should specify how to handle each column in the file. See the documentation examples:

Diese Frage ist geschlossen.

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by