Skip to content
Snippets Groups Projects
Commit 0782e393 authored by fritsch's avatar fritsch
Browse files

Upload New File

parent 11d8ad95
No related branches found
No related tags found
No related merge requests found
function dataOut = getDataAllFields(structInput, varNameInput)
% dataOut = getDataAllFields(structInput, varNameInput)
% compiles all data found under varNameInput into one output container
% Find the variable that is requested
fieldNames1 = fieldnames(structInput);
fieldNames2 = fieldnames(structInput.(fieldNames1{1}));
for ii = 1 : numel(fieldNames2)
ActDataNames = fieldnames(structInput.(fieldNames1{1}).(fieldNames2{ii}));
NamePos = strcmp(ActDataNames, varNameInput);
if sum(NamePos) == 1
IdxDataSet = ii;
end
end
% Compile output data
for ii = 1 : numel(fieldNames1)
currField = fieldNames1{ii};
dataOut{ii} = structInput.(currField).(fieldNames2{IdxDataSet}).(varNameInput);
end
end
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment