Home > functions > internal > dsMakeDefaultConfig.m

dsMakeDefaultConfig

PURPOSE ^

dsMakeDefaultConfig - write default DS config vars to disk as text file in main DS dir.

SYNOPSIS ^

function makeDefaultConfig()

DESCRIPTION ^

 dsMakeDefaultConfig - write default DS config vars to disk as text file in main DS dir.

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function makeDefaultConfig()
0002 % dsMakeDefaultConfig - write default DS config vars to disk as text file in main DS dir.
0003 
0004 %% Get Vars
0005 % Get home path
0006 if ispc
0007     host_name= getenv('COMPUTERNAME');
0008     home_path= getenv('HOMEPATH');
0009 else
0010     [~, host_name]=system('echo $HOSTNAME');
0011     home_path= getenv('HOME');
0012 end
0013 host_name = strtrim(host_name); % remove whitespace from host_name
0014 
0015 docs_path = fullfile(home_path, 'Documents');
0016 
0017 % Docs folder
0018 ds_data_path = fullfile(docs_path,'DynaSimData');
0019 demos_path = fullfile(ds_data_path, 'demos');
0020 mex_path = fullfile(ds_data_path,'mexes');
0021 
0022 ds_root_path = fileparts(fileparts(which('dsSimulate')));
0023 
0024 demos_zips_path = fullfile(ds_root_path, 'demos','demo_zips');
0025 
0026 ds_unitTestData_path = fullfile(ds_root_path, 'unitTestData');
0027 
0028 %% Write vars to disk
0029 vars = who; % get all vars
0030 
0031 fid = fopen(fullfile(ds_root_path, 'dsConfig.txt'), 'w');
0032 
0033 for thisVar = vars(:)'
0034   thisVar = thisVar{1};
0035   
0036   fprintf(fid, '%s = "%s"\r\n', thisVar,eval(thisVar));
0037 end
0038 
0039 fclose(fid);
0040 
0041 end

Generated on Tue 12-Dec-2017 11:32:10 by m2html © 2005