Borrar filtros
Borrar filtros

How to Concetanate Arrays in a Struct?

1 visualización (últimos 30 días)
Malte Räuchle
Malte Räuchle el 4 de Jun. de 2020
Comentada: Rik el 4 de Jun. de 2020
Hi. I want to chain the two arrays together in a 1x2 struct. In the command window, this also works perfectly (either via vertcat or via [...; ...]). However, it does not work after integration into the code. Any ideas?
Here is the Code ( I want to connect the different Arrays from the Field "Durchschnittswert") :
for idx_act_Channel=1:size(idx_Channel,2)
% ein Resultat --> Durchschnitt innerhalb dieses Intervalls
MasterResult(idx_loopi).Durchschnittswert(counter,idx_act_Channel)= mean(test(idx_loopi).Channels(idx_act_Channel).Data(idxStart:i));
MasterResult(idx_loopi).Maximalwert(counter,idx_act_Channel)= max(test(idx_loopi).Channels(idx_act_Channel).Data(idxStart:i));
MasterResult(idx_loopi).Minimalwert(counter,idx_act_Channel)= min(test(idx_loopi).Channels(idx_act_Channel).Data(idxStart:i));
%Umwandlung in Tabelle
Modus = struct2table(MasterResult);
%Aneinanderreihen der Daten der eingelesenen Files
%(vertikal) ! - aber kann nicht integriert werden?
%ModusMio = vertcat(Modus.Durchschnittswert{1,1}, Modus.Durchschnittswert {2,1}, Modus.Durchschnittswert {3,1});
%vertcat (Modus.Durchschnittswert{1,1}, Modus.Durchschnittswert {2,1}, Modus.Durchschnittswert {3,1});
end
And this is the Struct

Respuesta aceptada

Rik
Rik el 4 de Jun. de 2020
You were close with your commented code.
%see what this returns?
MasterResult.Durchschnittswert
%you can concatenate that comma separated list:
MergedData=vertcat(MasterResult.Durchschnittswert);
  8 comentarios
Malte Räuchle
Malte Räuchle el 4 de Jun. de 2020
Now it works! Thanks for your advice (stupid from me) :)
Rik
Rik el 4 de Jun. de 2020
No problem, happy to help

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Octave 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