Clear Filters
Clear Filters

datestr(double()) suddenly not working for transforming dates' format

1 view (last 30 days)
Hello everyone,
I have a dataset 2723555x3. The three variables are: Company ID, Date, NetIncome. I used yesterday the following code to transform the date in the format yyyymm:
formatOut = 'yyyymm'; NetIncome.date=datestr(double(NetIncome.date), formatOut);
It worked perfectly yesterday, while today it doesn’t. [If I try with only one date it still works well, though].
If I run the code, I obtain a 16341330x3 dataset and I receive the following messages:
Warning: Observations with default values added to dataset variables. > In dataset/subsasgnDot (line 213) In dataset/subsasgn (line 84)
Error using horzcat Requested 98047980x6 (4.4GB) array exceeds maximum array size preference. Creation of arrays greater than this limit may take a long time and cause MATLAB to become unresponsive. See array size limit or preference panel for more information.
Error in dateformverify (line 32) S = char(formatdate([y,mo,d,h,minute,s],dateformstr,islocal));
Error in datestr (line 194) S = dateformverify(dtnumber, dateformstr, islocal);
What could be the reason why yesterday was everything fine and now not anymore? Do you know how I can solve the problem?
Thank you very much in advance!

Answers (1)

the cyclist
the cyclist on 7 Apr 2016
Because the code did not change, I assume the underlying data did. Maybe one of the new data points is in the wrong format?
You could try running your code on just half the data, then the other half, and so on, until you narrow it down to just a few entries that might be causing the problem.
  1 Comment
Shantina
Shantina on 7 Apr 2016
Thank you for your prompt answer! Actually the data are exactly the same file. I just forgot to save yesterday, and I had to run again the code.

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!