clear
clc
nNames=["Trunk_Fwd_Tilt";"Trunk_Lat_Tilt";"Trunk_Rotation";"Pelvis_Fwd_Tilt";"Pelvis_Lat_Tilt";"Pelvis_Rotation";"R_HIPFlexANG";"R_HIPAbdANG";"R_HIPRotANG";"R_KNEEFlexANG";"R_KNEEAbdANG";"R_KNEERotANG";"R_ANKFlexANG";"R_Foot_Orientation";"R_Shl_Flex_Ang";"L_HIPFlexANG";"L_HIPAbdANG";"L_HIPRotANG";"L_KNEEFlexANG";"L_KNEEAbdANG";"L_KNEERotANG";"L_ANKFlexANG";"L_Foot_Orientation";"L_Shl_Flex_Ang";"R_KNEEPWR";"R_ANKPWR";"L_HIPPWR";"L_KNEEPWR";"L_ANKPWR"];
pName=["Trunk Tilt","Trunk Obliquity","Trunk Rotation","Pelvic Tilt","Pelvic Obliquity","Pelvic Rotation","Hip Flexion/Extension","Hip Ad/Abduction","Hip Rotation","Knee Flexion/Extension","Knee Varus/Valgus","Knee Rotation","Ankle Dorsi/Plantar","Foot Progress wrt Room","Shank Rotation"];
direc=["EXAMPLE NAME","EXAMPLE NAME","EXAMPLE NAME"];
fileID=fopen(EXAMPLE NAME,'w');
pasteTable=table();
for tInc=20:30
sFind=strcat("_hss_",num2str(tInc));
for dirInc=1:3
dirInfo=dir(direc(dirInc));
structSize=(size(dirInfo));
for nInc=1:structSize(1)
dirName=dirInfo(nInc).name;
pHold=string(dirName);
if contains(pHold,sFind)
pHold=strcat(direc(dirInc),pHold);
fprintf(fileID,'%s\n',pHold);
end
end
end
end
opts=delimitedTextImportOptions('LineEnding','\n');
dirNames=readtable('EXAMPLE NAME',opts);
for nInc=1:height(dirNames)
dest=dirNames.Var1(nInc);
dest=char(dest);
[nOutTable,topCol]=Norm2Tab(dest);
for i=1:length(nNames)
vName=nNames(i);
fName=strcat('EXAMPLE NAME',vName,'.txt');
fileID2=fopen(fName,'w');
for j=1:height(dirNames)
pHold=nOutTable(1:100,vName);
cName=char(strcat("Var"+j));
pHold.Properties.VariableNames={cName};
pasteTable=[pasteTable pHold]
end
writetable(pasteTable,fName,'WriteVariableNames',false);
end
end
0 Comments
Sign in to comment.