data frequency conversion -cell matrix
Show older comments
Dear all,
I have the following cell matrix
A = {
1 ' ' [ NaN] [ NaN]
1 ' ' [ NaN] [ NaN]
1 ' ' [ NaN] [ NaN]
1 'MA 2009' [ 0] [ 0]
1 'MJ 2009' [ 0.2680] [ 3.0394]
1 'JA 2009' [ 0.0504] [ 0.6475]
1 'SO 2009' [ 14.0985] [ 148.2583]
1 'ND 2009' [ 0.1128] [ 1.1506]
1 'JF 2010' [ NaN] [ 148.2583]
1 'MA 2010' [ 2.5852] [ 34.0146]
1 'MJ 2010' [ 0.3220] [ 3.2846]
1 'JA 2010' [ 14.0985] [ 148.2583]
1 'SO 2010' [ 2.5852] [ NaN]
1 'ND 2010' [ 0.2938] [ 2.8540]
1 'JF 2011' [ 0.1128] [ 1.1506]
1 'MA 2011' [ 14.0985] [ 148.2583]
1 'MJ 2011' [ 2.1091] [ 15.0233]
1 'JA 2011' [ 0] [ 0]
2 ' ' [ NaN] [ NaN]
2 ' ' [ NaN] [ NaN]
2 ' ' [ NaN] [ NaN]
2 'MA 2009' [ 14.0985] [ 148.2583]
2 'MJ 2009' [ 2.7827] [ 18.9879]
2 'JA 2009' [ 11.8755] [ 126.4359]
2 'SO 2009' [ 0.0589] [ 0.6685]
2 'ND 2009' [ 11.8755] [ 126.4359]
2 'JF 2010' [ 0.0504] [ 0.6475]
2 'MA 2010' [ 11.8755] [ 126.4359]
2 'MJ 2010' [ 0.0504] [ 0.6475]
2 'JA 2010' [ 0] [ 0]
2 'SO 2010' [ 0.0248] [ 0.2823]
2 'ND 2010' [ 0] [ 0]
2 'JF 2011' [ 2.5852] [ 34.0146]
2 'MA 2011' [ 0.0207] [ 0.2282]
2 'MJ 2011' [ 11.8755] [ 126.4359]
2 'JA 2011' [ 14.0985] [ 148.2583]
3 ' ' [ NaN] [ NaN]
3 ' ' [ NaN] [ NaN]
3 ' ' [ NaN] [ NaN]
3 'MA 2009' [ 2.1091] [ 15.0233]
3 'MJ 2009' [ 0] [ 0]
3 'JA 2009' [ 0.1128] [ 1.1506]
3 'SO 2009' [ 0.0207] [ 0.2282]
3 'ND 2009' [ 0] [ 0]
3 'JF 2010' [ NaN] [ 1.1506]
3 'MA 2010' [ 0] [ 0]
3 'MJ 2010' [ 2.1091] [ 15.0233]
3 'JA 2010' [ 0] [ 0]
3 'SO 2010' [ 2.7827] [ NaN]
3 'ND 2010' [ 0] [ 0]
3 'JF 2011' [ 0.0207] [ 0.2282]
3 'MA 2011' [ 2.5852] [ 34.0146]
3 'MJ 2011' [ 0] [ 0]
3 'JA 2011' [ 11.8755] [ 126.4359]
}
I want to convert these data from Bimontly to monthly for each inividual i (first column).
I searched for relevant functions and I found for example: tomonthly() but I do not know how to exactly apply it to the above setting. Note that I have 30000 invividuals and 20 numerical columns instead of the last 2 that I display above
Any help is greately appreicated thanks in advance
9 Comments
salva
on 26 Jul 2012
per isakson
on 26 Jul 2012
You write:
"I want to convert these data from Bimontly to monthly
for each inividual i (first column)."
but you don't write by what rule that should be done. Divide the bimonthly value by two?
per isakson
on 27 Jul 2012
Edited: per isakson
on 27 Jul 2012
newfts = tomonthly(oldfts)
where
oldfts is Financial time series object
I don't have the Financial toolbox. However, the documentation indicates that tomonthly calculates monthly data from data with higher resolution, e.g. daily. I don't think it can take bimonthly data.
I cannot make sense of your example. Am I right that
1, 'MJ 2009', 0.2680, 3.0394
is data for May and June 2009, i.e. 5/2009 and 6/2009? In your example you assign these numbers to 4/2009.
salva
on 27 Jul 2012
Andrei Bobrov
on 27 Jul 2012
What would you like to have instead of ?
A = {...
1 'MA 2009' [ 0] [ 0]
1 'MJ 2009' [ 0.2680] [ 3.0394]
1 'JA 2009' [ 0.0504] [ 0.6475]}
in
Aout = {...
1 '3/2009' [ ?] [ ?]
1 '4/2009' [ ?] [ ?]
1 '5/2009' [ ?] [ ?]
1 '6/2009' [ ?] [ ?]
1 '7/2009' [ ?] [ ?]
1 '8/2009' [ ?] [ ?]}
salva
on 27 Jul 2012
Oleg Komarov
on 27 Jul 2012
@Andrei: he wants to divide it by 2.
Accepted Answer
More Answers (0)
Categories
Find more on Data Type Conversion in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!