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

조회 수: 1 (최근 30일)
cemsi888
cemsi888 2015년 3월 4일
댓글: cemsi888 2015년 3월 5일
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?

채택된 답변

Guillaume
Guillaume 2015년 3월 5일
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
cemsi888
cemsi888 2015년 3월 5일
thanx for answer. it works
cemsi888
cemsi888 2015년 3월 5일
i created new question for my second question...

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Introduction to Installation and Licensing에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by