how can i combine 2 structure array in one structure array?

1 visualización (últimos 30 días)
cemsi888
cemsi888 el 4 de Mzo. de 2015
Comentada: cemsi888 el 5 de Mzo. de 2015
Hi i am using gui and in order to see desired results on Workspace i use assignin fucntion.
assignin('base','Info',Info)
assignin('base',meinmappe{i},Readin_parameters)
assignin('base',meinmappe{i},Readin_Headers)
meinmappe is structure Array which must include Readin_parameters and Readin_Headers. However Matlab save just Readin_parameters in to meinmappe{i} but i want both of them. How can i solve this Problem? Readin_Parameter and Readin_Headers are structure Arrays that include more than 100 Parameters (it depends on Experiment results) ant they own their values too. Second Question= Now i am reading like txt files .first Comes Parameters than values.every meauserment file have different numberof values thats why formatSpecification changes. Exmaple: formatSpec4 = '%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%........%[^\n\r]'; (s* line) how can i define my formatspecification regarding to line number?

Respuesta aceptada

Guillaume
Guillaume el 5 de Mzo. de 2015
Assuming that both structures don't share any field names, you can combine them with this:
combinestructs = @(s1, s2) cell2struct([struct2cell(s1); struct2cell(s2)], [fieldnames(s1); fieldnames(s2)]);
assignin('base', meinmappe{i}, combinestructs(Readin_parameters, Readin_Headers));
As for your second question, pleas post it separately (and format it properly).
  2 comentarios
cemsi888
cemsi888 el 5 de Mzo. de 2015
thanx for answer. it works
cemsi888
cemsi888 el 5 de Mzo. de 2015
i created new question for my second question...

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Introduction to Installation and Licensing en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by