filling the gaps in the sequence of dates
이전 댓글 표시
EDITED
Dear all,
I have A={
'kl' '10/08' [4.4840] [4.1101] [ 0]
'kl' '01/09' [4.4840] [4.1101] [ 0]
'kl' '02/09' [4.1101] [4.0311] [ 0]
'kl' '03/09' [4.0311] [3.9358] [ 0]
'kl' '04/09' [3.9358] [3.9739] [ 0]
'kl' '05/09' [3.9739] [3.9267] [ 0]
'kl' '07/09' [3.9059] [3.8655] [ 0]
'kl' '08/09' [3.8655] [3.8889] [3.7498]
'kl' '10/09' [3.7498] [3.8857] [ 0]
'kl' '11/09' [3.8857] [4.4207] [4.1647]
'kl' '01/10' [4.1647] [3.7704] [ 0]
'kl' '02/10' [3.7495] [3.7085] [ 0]
'kl' '04/10' [3.7085] [3.6800] [ 0]
'kl' '05/10' [3.6800] [3.7364] [3.7867]
'kl' '07/10' [3.7867] [3.7860] [ 0]
'kl' '08/10' [3.7860] [3.7888] [3.6435]
'kl' '10/10' [3.6435] [3.6149] [ 0]
'kl' '11/10' [4.2260] [3.8786] [ 0]
'kl' '01/11' [3.8786] [3.5946] [3.5765]
'kl' '02/11' [3.5765] [3.5946] [ 0]
'kl' '04/11' [3.5946] [3.6493] [ 0]
'kl' '05/11' [3.6493] [3.5918] [3.6956]
'kl' '07/11' [3.6956] [3.7282] [ 0]
'kl' '08/11' [3.7326] [3.6308] [ 0]
'kl' '10/11' [3.6308] [3.6523] [4.1421]
'kl' '11/11' [4.1421] [2.0710] [ 0]}
The second column is month/year. Is it possible to fill the gaps in the sequence of the dates and for this additional row to set the rest of the elements equal to NaN? Specifically, the first date changes and is not fixed. Also the last date must be the date of the last row.
That is;
A={
'kl' '10/08' [4.4840] [4.1101] [ 0
[NaN] '11/08' [NaN] [NaN] [NaN]
[NaN] '12/08' [NaN] [NaN] [NaN]
'kl' '01/09' [4.4840] [4.1101] [ 0]
'kl' '02/09' [4.1101] [4.0311] [ 0]
'kl' '03/09' [4.0311] [3.9358] [ 0]
'kl' '04/09' [3.9358] [3.9739] [ 0]
'kl' '05/09' [3.9739] [3.9267] [ 0]
[NaN] '06/09' [NaN] [NaN] [NaN]
'kl' '07/09' [3.9059] [3.8655] [ 0]
'kl' '08/09' [3.8655] [3.8889] [3.7498]
[NaN] '09/09' [NaN] [NaN] [NaN]
'kl' '10/09' [3.7498] [3.8857] [ 0]
'kl' '11/09' [3.8857] [4.4207] [4.1647]
[NaN] '12/09' [NaN] [NaN] [NaN]
And so forth . the last date must be
'11/11'
Just to mentionthat the last date may change and is not fixed as it happens with the first date. SO the "last date" can be any date and the code must not create any new dates after the "last date"
Thanks in advance
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Dates and Time에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!