1%% determine the file name
2if (uniform_sgrid == 1)
3 str = 'uni'; else; str = 'rand'; end
5% Save only the selected variables
6fileName = sprintf('%s/WFPworkspaceO%d_T%d_%sM%d_b%d',dataFile,order,round(tFinal),str,M,betaMax);
7 matlabDataFile =strcat(fileName,'.mat');
9if (saveWorkspaceOpt == 1)
10 % all variables in the workspace
11 vars = who;
13 % variables to exclude
14 exclude = {'A_sp','It','RHS','deltaInteractions',...
15 'dtInteractions','evalSol','gl','gn','historySum',...
16 'implicitMat','interpAndGLWeights_sol','interpNodesIdx_sol',...
17 'interpShift_sol','it1','it2','p','p0','phi_tn','phit_tn',...
18 'printTimeStep','q','q0','saveWorkspaceOpt',...
19 'sn_v','timeSteppingTime','uniform_beta','uniform_sgrid',...
20 'winData'};
22 % Find variables to save
23 vars_to_save = setdiff(vars, exclude);
24 save(fileName, vars_to_save{:});
25 fprintf('saved workspace to %s\n',matlabDataFile);
27elseif(addErrResults == 1)
28 if(isfile(matlabDataFile))
29 save(fileName, 'sc_err', '-append');
30 fprintf('added error to the data file in %s\n',matlabDataFile);
31 else
32 fprintf('Did not add the error to the data file %s\n',matlabDataFile);
33 end
34end