Removing Space from code output II
古いコメントを表示
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
回答 (1 件)
Azzi Abdelmalek
2013 年 2 月 6 日
A=[0 1 2 3 4];
a=num2str(A)
a(a==' ')=[];
out=str2num(a)
カテゴリ
ヘルプ センター および File Exchange で MATLAB Coder についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!