MATLAB: Problem with string assembly

assemblyloopstring

Hy all for my code,
V_AA = [100; 200]
L_AA = length(V_AA)
S_AA = num2str(V_AA)
for i=1:L_AA
F_AA{i} = ['N°: ' S_AA(i)];
end
i'm unable to get :
F_AA{1} = N°: 100
F_AA{2} = N°: 200
Thanks

Best Answer

V_AA = [100; 200]
L_AA = length(V_AA)
for i=1:L_AA
F_AA{i} = sprintf('N°: %d', V_AA(i))
end
%or without for loop
F_AA=regexp(sprintf('N°: %d ', V_AA'),'N°: \d+','match')
Related Question