how to use the split function the below dataset
古いコメントを表示
raw={'12_peeter','14_kumar','34_jai','56_papu'}
how to replace this format
a={'peeter-12','kumar-14','jai-34','papu-56'}
but iam try split function
temp=raw;
for i=1:length(temp)
a=strsplict(temp(i),'_');
temp=strcat(temp1(2),'-',temp1(1));
raw(i)=temp;
end
but it gives
??? Undefined function or method 'strsplict' for input arguments of type 'char'.
採用された回答
その他の回答 (2 件)
Walter Roberson
2017 年 1 月 4 日
0 投票
You misspelled strsplit()
Stephen23
2017 年 1 月 4 日
>> raw = {'12_peeter','14_kumar','34_jai','56_papu'};
>> out = regexprep(raw,'(\d+)_(\w+)','$2-$1');
And checking the output:
>> out{:}
ans = peeter-12
ans = kumar-14
ans = jai-34
ans = papu-56
カテゴリ
ヘルプ センター および File Exchange で NaNs についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!