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!