I have four 1x50 matrices and I want to save them to one 4x50 matrix. How can I do this?
2 次查看(过去 30 天)
显示 更早的评论
I have four 1x50 matrices and I want to save them to one 4x50 matrix. How can I do this?
2 个评论
Jan
2013-2-5
@Teemu: I strongly suggest, that you ask the admins to restore your question. Otherwise there is the chance, that the contributors will ignore your questions in the future, because they could assume, that you are not serious. You find the address at the bottom of this page or you can ask randy Souza. Thanks.
采纳的回答
Azzi Abdelmalek
2013-2-5
编辑:Azzi Abdelmalek
2013-2-5
for k=1:50
title{k}=sprintf('title%d',k)
end
a=rand(1,50);
b=rand(1,50);
c=rand(1,50);
d=rand(1,50);
M=[title;num2cell(a);num2cell(b);num2cell(c);num2cell(d)]
3 个评论
Azzi Abdelmalek
2013-2-5
编辑:Azzi Abdelmalek
2013-2-5
Try again, but before, type: clear
clear
for k=1:50
titre{k}=sprintf('title%d',k)
end
a=rand(1,50);
b=rand(1,50);
c=rand(1,50);
d=rand(1,50);
M=[titre;num2cell(a);num2cell(b);num2cell(c);num2cell(d)]
I've also changed the variable title which is reserved to ploting functions
更多回答(2 个)
Youssef Khmou
2013-2-5
Suppose your matrices are A,B,C,D all with size 1x50 :
M=zeros(4,50);
M(1,:)=A;
M(2,:)=B;
M(3,:)=C;
M(4,:)=D;
0 个评论
Ryan Livingston
2013-2-5
A = rand(1,50);
B = rand(1,50);
C = rand(1,50);
D = rand(1,50);
E = [A;B;C;D];
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Resizing and Reshaping Matrices 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!