How to put unknown no. of elements array in one array from a loop?
Show older comments
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 Comments
Andrew Reibold
on 19 Aug 2014
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
on 19 Aug 2014
dpb
on 19 Aug 2014
One vector or a cell array of various-length vectors?
I showed how to get either...
Accepted Answer
More Answers (0)
Categories
Find more on Creating and Concatenating Matrices 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!