How to put unknown no. of elements array in one array from a loop?
Mostrar comentarios más antiguos
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 comentarios
Andrew Reibold
el 19 de Ag. de 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
el 19 de Ag. de 2014
dpb
el 19 de Ag. de 2014
One vector or a cell array of various-length vectors?
I showed how to get either...
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Creating and Concatenating Matrices en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!