concatenate multiple variables from multiple .mat files

Hello All,
I need a help in concatenate multiple variables from multiple .mat files stored in multiple folders.
Below is my code, I am not able to get forward with the logic.
clear all
close all
d = uigetdir();
S = dir(fullfile(d,'*'));
N = setdiff({S([S.isdir]).name},{'.','..'});
inputfile=fullfile(d, 'input.xlsx');
input_file=dir(inputfile);
read_inputs=readtable([d '\' input_file.name]);
parameter_list={'Var_1','Var_2','Var_3'};
for ii = 1:numel(N)
T =dir(fullfile(d,N{ii},'*.mat'));
T([T.isdir]) = [];
fprintf('Now Reading Folder %s\n',d,N{ii});
for jj = 1:numel(T)
F = fullfile(d,N{ii},T(jj).name);
fprintf('Now Reading file %s\n',F);
for kk = 1:numel(parameter_list)
Parameter_name=char(parameter_list(kk));
x=load(F);
if isfield(x,Parameter_name)
fprintf('Found paramter=%s\n',Parameter_name);
parameter(:,kk).data = (x.(char(Parameter_name)));
end
Conc_paramter(:,jj).data=vertcat(parameter.data);
end
end
end
What I want is a final .mat file where all the parameters are concatenated with parameter names.

답변 (0개)

카테고리

도움말 센터File Exchange에서 Data Type Identification에 대해 자세히 알아보기

질문:

2019년 12월 10일

편집:

2019년 12월 10일

Community Treasure Hunt

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

Start Hunting!

Translated by