Concatenating array using for loop

3 visualizaciones (últimos 30 días)
aldburg
aldburg el 18 de Feb. de 2018
Comentada: Stephen23 el 19 de Feb. de 2018
I have a structure with some arrays listed like this from 1 to 9 :
Cure.neat(1).temps
Cure.neat(2).temps
.....
I would like to combine the arrays into one matrix such as:
A = [ Cure.neat(1).temps Cure.neat(2).temps etc... ]
for i = 1 :9

Respuesta aceptada

aldburg
aldburg el 18 de Feb. de 2018
I was able to get it to work with the following code:
% Forms matrix to hold data
Master_temps = zeros(numel(Cure_Kinetics.neat(1).iterated.temps), number_of_data_files)
% Compiles all neat iterated temps into one master matrix
for i = 1:number_of_data_files
Master_temps(:,i) = Cure_Kinetics.neat(i).iterated.temps
end
% Places master matrix into data structure
Cure_Kinetics.neat_model.compiled_temps = Master_temps
  1 comentario
Stephen23
Stephen23 el 19 de Feb. de 2018
See my answer for a simpler solution.

Iniciar sesión para comentar.

Más respuestas (1)

Stephen23
Stephen23 el 18 de Feb. de 2018
Editada: Stephen23 el 18 de Feb. de 2018

Categorías

Más información sobre Creating and Concatenating Matrices en Help Center y File Exchange.

Etiquetas

Productos

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by