MATLAB: How to convert char to array of string

convert char to array typeloop

I have a list of signals named name_final = 'PECCalc_tqElFil2_VW_173','PECCtl_bDampCtl_VW_173' etc..(58 signals) store in the form of cell. I want to delete the last 4 characters (_173) from these names and store it in the form of array. So I use for loop but for some reason it is giving an error stating "In an assignment A(:) = B, the number of elements in A and B must be the same." ( without the loop this codes runs successfully) How do I get these signals stored as array so that it is easy for me to copy? please help.
for r = 1:length(name_final) % name_final is cell type
name1 = name_final(r);
qq = cell2mat(name1); % qq is in the type char
name_new(r) = qq(1:end-4); %name_new is also of type char
end

Best Answer

name_final = {'PECCalc_tqElFil2_VW_173','PECCtl_bDampCtl_VW_173'}
out=regexp(name_final,'.+(?=.{4})','match','once')