breaking a column of strings in two different columns
古いコメントを表示
Dear all,
Inside the workspace I have the following column in cell format
Column 1
‘AR021108'
'AW301108'
'EW281208'
'RT250109'
'RY220209'
I was trying to break this column in two other where the first column will contain the first two elements of each of these string variables and the second one will contain the dates as follows
Column1 column 2
AR 02/11/08
AW 30/11/08
EW 28/12/08
RT 25/01/09
RY 22/02/09
Any suggestions?
採用された回答
その他の回答 (1 件)
Thomas
2012 年 6 月 19 日
a={'AR021108'
'AW301108'
'EW281208'
'RT250109'
'RY220209'};
ii=cellfun(@(x) x(1:2),a, 'UniformOutput', false);
jj=cellfun(@(x) [x(3:4) '/' x(5:6) '/' x(7:8)], a, 'UniformOutput', false);
out=[ii jj]
another way without loops..
カテゴリ
ヘルプ センター および File Exchange で Characters and Strings についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!