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

1 vue (au cours des 30 derniers jours)
cemsi888
cemsi888 le 4 Mar 2015
Commenté : cemsi888 le 5 Mar 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?

Réponse acceptée

Guillaume
Guillaume le 5 Mar 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 commentaires
cemsi888
cemsi888 le 5 Mar 2015
thanx for answer. it works
cemsi888
cemsi888 le 5 Mar 2015
i created new question for my second question...

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Introduction to Installation and Licensing dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by