How to put unknown no. of elements array in one array from a loop?
显示 更早的评论
Hi I want to store the all the factors calculated in the loop in one array(horz)
m a beginer....tried cell ..cat..etc..but since the no.of factors are unknown ...it keeps displaying an error...can smone help...
Thanx Babita
clc;
p=input('No. of periodic tasks');
for i=1:p
p_prd(i)=input('period of periodic task')
end
.......
x=cell(p:1)
for m=1:p
infac=factor(p_prd(m))
x{m}=infac{1}
..........
%fact=ones(1,100)
% for h=1:p
% infac=factor(p_prd(h))
% fact(infac)=cat(infac)
% % z(100)= horzcat(fac(100))
% end
................... all i want is to get the factors of p_prd into one horizintal array for further processing....
3 个评论
Andrew Reibold
2014-8-19
Ok, so in a nutshell. You have a matrix p_prd, and all you need is to turn that into one horizontal array?
Is that correct?
babita
2014-8-19
dpb
2014-8-19
One vector or a cell array of various-length vectors?
I showed how to get either...
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Creating and Concatenating Matrices 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!