how to convert string quarterly dates into numerical values?

4 visualizaciones (últimos 30 días)
Yelena
Yelena el 10 de En. de 2015
Comentada: dpb el 10 de En. de 2015
I have a column vector with quarterly dates ('Q1-2011', 'Q2-2011', etc.). I need to convert all entries in this column vector into strings so that I can create a time-series plot. Any ideas how to do it? I tried this program:
DateString = DataRussiaFinal1114(:,1);
formatIn = 'QQ-YY';
dates = datenum(DateString,formatIn);
But datenum gives an error: The input to DATENUM was not an array of strings.
  1 comentario
dpb
dpb el 10 de En. de 2015
What does
whos DateString
return? Either
>> datenum(['Q1-2011'; 'Q2-2011'],'QQ-YY')
ans =
734504
734594
or
>> datenum({'Q1-2011'; 'Q2-2011'},'QQ-YY')
ans =
734504
734594
>>
as character array or cellstr array work so must be some other storage issue that we can't see by description only...must see actual data.

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Más información sobre Dates and Time en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by