mkdir('ex_ext_ctrl_alg')
mkdir('ex_ext_inputs_proc')
mkdir('io_drivers')
mkdir('ex_ext_outputs_proc')
mkdir('shared')

path = fullfile(matlabroot,'examples','ecoder', 'data');

copyfile(fullfile(path,'ex_ext_inputs_proc.c'),fullfile('ex_ext_inputs_proc','ex_ext_inputs_proc.c'),'f')
copyfile(fullfile(path,'ex_ext_inputs_proc.h'),fullfile('ex_ext_inputs_proc','ex_ext_inputs_proc.h'),'f')
copyfile(fullfile(path,'ex_ext_proc_inputs.c'),fullfile('ex_ext_inputs_proc','ex_ext_proc_inputs.c'),'f')
copyfile(fullfile(path,'ex_ext_proc_inputs.h'),fullfile('ex_ext_inputs_proc','ex_ext_proc_inputs.h'),'f')

copyfile(fullfile(path,'ex_ext_outputs_proc.c'),fullfile('ex_ext_outputs_proc','ex_ext_outputs_proc.c'),'f')
copyfile(fullfile(path,'ex_ext_outputs_proc.h'),fullfile('ex_ext_outputs_proc','ex_ext_outputs_proc.h'),'f')

copyfile(fullfile(path,'ex_ext_projTypes.h'),fullfile('shared','ex_ext_projTypes.h'),'f')

copyfile(fullfile(path,'ex_actuator_accessors.c'),fullfile('io_drivers','ex_actuator_accessors.c'),'f')
copyfile(fullfile(path,'ex_actuator_accessors.h'),fullfile('io_drivers','ex_actuator_accessors.h'),'f')
copyfile(fullfile(path,'ex_sensor_accessors.c'),fullfile('io_drivers','ex_sensor_accessors.c'),'f')
copyfile(fullfile(path,'ex_sensor_accessors.h'),fullfile('io_drivers','ex_sensor_accessors.h'),'f')

try 
    copyfile(fullfile(path,'ext_code_main.c'),'ext_code_main.c','f')
catch
end