projectdir = 'C:\Users\it58528\Documents';
folderinfo = dir(projectdir);
folderinfo = folderinfo([folderinfo.isdir]);
folderinfo = folderinfo(~ismember({folderinfo.name}, {'.', '..'}));
for folderidx = 1 : length(folderinfo)
thisfolder = fullfile(projectdir, folderinfo(folderidx).name);
subfolderinfo = dir(thisfolder);
subfolderinfo = subfolderinfo([subfolderinfo.isdir]);
subfolderinfo = subfolderinfo(~ismember({subfolderinfo.name}, {'.', '..'}));
for subfolderidx = 1 : length(subfolderinfo)
thissubfolder = fullfile(thisfolder, subfolderinfo(subfolderidx).name);
fileinfo = dir( fullfile(thissubfolder, '*.csv') );
for fileidx = 1 : length(fileinfo)
thisfile = fullfile(thissubfolder, fileinfo(fileidx).name);
[filepath, basename, ext] = fileparts(thisfile);
data = csvread(thisfile,5,2);
PIN(fileidx).PIN = fileinfo(fileidx).name(1:17);
PIN(fileidx).loadprofile = data(1:15,:);
PIN(fileidx).hours = sum(sum(PIN(fileidx).loadprofile,1));
PIN(fileidx).loadprofilepercent = PIN(fileidx).loadprofile./PIN(fileidx).hours;
PIN(fileidx).loadpercent = data(:,2);
PIN(fileidx).RPM = data(16,:);
loadprofilecolumn = find(PIN(fileidx).RPM>Resonance);
xSpeed = PIN(fileidx).RPM(loadprofilecolumn(1)-1);
PIN(fileidx).TimeatLevel = Test_Goal*PIN(fileidx).loadprofilepercent(:,loadprofilecolumn(1)-1);
PIN(fileidx).TestTime = PIN(fileidx).TimeatLevel./((TestLevel./Modeled_Accel).^m);
PIN(fileidx).TotalTestTime = sum(PIN(fileidx).TestTime);
PINs(fileidx,1:17) = PIN(fileidx).PIN;
FieldHours(fileidx,1) = PIN(fileidx).hours;
TestHours(fileidx,1) = PIN(fileidx).TotalTestTime;
2 Comments
Direct link to this comment
https://de.mathworks.com/matlabcentral/answers/251272-how-to-save-a-structure-as-mat#comment_1228332
Direct link to this comment
https://de.mathworks.com/matlabcentral/answers/251272-how-to-save-a-structure-as-mat#comment_1228332
Direct link to this comment
https://de.mathworks.com/matlabcentral/answers/251272-how-to-save-a-structure-as-mat#comment_1228642
Direct link to this comment
https://de.mathworks.com/matlabcentral/answers/251272-how-to-save-a-structure-as-mat#comment_1228642
Sign in to comment.