Removing Space from code output II
Show older comments
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
Answers (1)
Azzi Abdelmalek
on 6 Feb 2013
A=[0 1 2 3 4];
a=num2str(A)
a(a==' ')=[];
out=str2num(a)
Categories
Find more on MATLAB Coder in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!