Removing Space from code output II
Afficher commentaires plus anciens
Hello,
I've been able to generate the number of combinations of the four vectors A, B,C,and D listed below. But I want the spaced to be removed from the output.
for example the results output looks like this below
4 5 4 0
4 5 4 1
4 5 4 2
4 5 4 3
4 5 4 4
and I want it to look like
4540
4541
4542
4543
4544
is there a fprint function, etc. I should use? Thank you in advance.
The actual code is below:
A=[0 1 2 3 4];
B=[0 1 2 3 4 5];
C=[0 1 2 3 4];
D=[0 1 2 3 4];
combo=zeros(4,750);
m=1;
for i=1:5
for j=1:6
for k=1:5
for l=1:5
combo(:,m)=[A(i);B(j);C(k);D(l)];
m=m+1;
end
end
end
end
Réponses (1)
Azzi Abdelmalek
le 6 Fév 2013
A=[0 1 2 3 4];
a=num2str(A)
a(a==' ')=[];
out=str2num(a)
Catégories
En savoir plus sur MATLAB Coder dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!