Concatenating structure array with matrix

2 visualizaciones (últimos 30 días)
Alexandre
Alexandre el 13 de Mzo. de 2014
Respondida: Sarthak el 20 de Feb. de 2023
Hi you all. How can i concatenate this files? Each one has structure array and a matrix with values.
  1 comentario
dpb
dpb el 13 de Mzo. de 2014
Directly you can't. You'll need to create a new data storage scheme to handle the various types of data. Perhaps add the new array to the previous structure?

Iniciar sesión para comentar.

Respuestas (1)

Sarthak
Sarthak el 20 de Feb. de 2023
Hi,
As far as I have understood the question, you want to concatenate two files which contain array and matrix.
You can use ‘cat’ function for the same.
Please refer to the pseudo code below:
struct_concat = [];
for i = 1:numel(field_names) %field_names are the name of the fields in the structure
field = field_names{i};
struct_concat.(field) = [struct1.(field); struct2.(field)];
end

Categorías

Más información sobre Structures en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by