How to vectorize the following code
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
pietro
el 3 de Oct. de 2014
Comentada: pietro
el 8 de Oct. de 2014
Hi all,
I have the following code, is there any way to vectorize it?
RMH(1).D=rand(20,4);
RMH(2).D=rand(20,4);
a=zeros(length(RMH),numel(RMH(1).D));
for i=1:length(RMH)
a(i,:)=reshape(RMH(i).D,1,numel(RMH(i).D));
end
Thank you
Regards
Pietro
2 comentarios
Respuesta aceptada
Andrei Bobrov
el 3 de Oct. de 2014
Editada: Andrei Bobrov
el 3 de Oct. de 2014
a = reshape([RMH.D],[],numel(RMD))';
Más respuestas (0)
Ver también
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!