more efficient way to use strtok / selecting parts of a string
이전 댓글 표시
Greetings,
I have a huge cell array with time data arranged in the following format :
[one empty cell];
ABC/DEF QTR/3/99 (Thousands);
ABC/DEF QTR/6/99 (Thousands);
ABC/DEF QTR/9/99 (Thousands);
ABC/DEF QTR/12/99 (Thousands);
etc...
I would like to change the format into this :
ABC/DEF;
QTR/3/99;
QTR/6/99;
QTR/9/99;
QTR/12/99;
etc...
I've solved the problem but think it can be done much more efficiently:
[varname, mthtime2(2:end)] = strtok(mthtime2(2:end));
mthtime2(2:end)= strtok(mthtime2(2:end));% drops the "thousands" mthtime2(1)=varname(1);
Suggestions for a faster method would be most appreciated. Thank you for your time!
Iliya
댓글 수: 2
Walter Roberson
2012년 1월 28일
Is the mthtime2(1)=varname(1) commented out, or should it be on the next line?
Daniel Shub
2012년 1월 28일
In order to get what iilya wants, mthtime2(1)=varname(1) needs to be uncommented.
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Data Import and Management에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!