MATLAB: How to use the split function the below dataset

??? undefined function or method 'strsplict' for input arguments of type 'char'.

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'.

Best Answer

You can do it in one line with the regexprep function:
raw={'12_peeter','14_kumar','34_jai','56_papu'}
a = regexprep(raw, '_', '-')
raw =
'12_peeter' '14_kumar' '34_jai' '56_papu'
a =
'12-peeter' '14-kumar' '34-jai' '56-papu'
Related Question