-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathparamsGenerator.m
30 lines (27 loc) · 1.17 KB
/
paramsGenerator.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
function [paramsFile]=paramsGenerator(experimentName,robotName)
%prompt to ask if we should copy from another experiment
if copyFromExperiment
paramsFile=fileread(strcat(experimentNameRef,'/params.m'));
else
paramsTemplate=fileread('paramsTemplate.m')
endLine='\n';
sectionStart='%%';
emptyStringsChars=''';';
fillVariable='input';
defaultNumber='0';
emptyCellArray='{};';
endLineIndexes= regexp(paramsTemplate,endLine);
sections=regexp(paramsTemplate,sectionStart); % ignore first section
stringsToFill=regexp(paramsTemplate,emptyStringsChars); % expecting a string
numbersToChange=regexp(paramsTemplate,defaultNumber); % this should be changed
cellArrayToFill=regexp(paramsTemplate,emptyCellArray); % expecting a cell array
% collect inital description of the params file
outputParams=paramsTemplate(1:sections(2)-1);
%lines in section
%% Variables that depend on the type of experiment
linesInSection=endLineIndexes(endLineIndexes>sections(2) & endLineIndexes<sections(3));
% eval('ftNames={''left_arm'';''right_arm'';''left_leg'';''right_leg'';''left_foot'';''right_foot''};')
end
fid = fopen(strcat(experimentName,'/params.m'),'w');
fprintf(fid, '%s', paramsFile);
fclose(fid);