/* The function write_param.c, which is called when a relevant parameter update has been made, copies the working parameter file to a new file with the same name but with extension .num, the number of parameter updates that have currently been made during the simulation period. Function arguments: pararameterfilein - MATLAB array containing name of working parameter file countin - MATLAB array indicating number of updates that have been currently made during the simulation period Function outputs: none */ #include #include #include #include #include #include void mlfWrite_param(const mxArray *parameterfilein, const mxArray *countin) { /* Declaring variables */ char command[128], *parameterfile, *count; /* Converting MATLAB types to C types */ parameterfile=mxArrayToString(parameterfilein); count=mxArrayToString(countin); /* Copying updated working parameter file to a new file. */ sprintf(command,"cp %s %s.%s",parameterfile,parameterfile,count); system(command); /* Freeing allocated dynamic memory and returning to simulate.m */ mxFree(parameterfile); mxFree(count); return; }