


convert function handles in string variables THIS IS NO USER FUNCTION


0001 function pbeDef = convertStringToFunctionPbe(pbeDef) 0002 % convert function handles in string variables 0003 % 0004 % THIS IS NO USER FUNCTION 0005 0006 % The elk-library: convex geometry applied to crystallization modeling. 0007 % Copyright (C) 2012 Alexander Reinhold 0008 % 0009 % This program is free software: you can redistribute it and/or modify it 0010 % under the terms of the GNU General Public License as published by the 0011 % Free Software Foundation, either version 3 of the License, or (at your 0012 % option) any later version. 0013 % 0014 % This program is distributed in the hope that it will be useful, but 0015 % WITHOUT ANY WARRANTY; without even the implied warranty of 0016 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 0017 % General Public License for more details. 0018 % 0019 % You should have received a copy of the GNU General Public License along 0020 % with this program. If not, see <http://www.gnu.org/licenses/>. 0021 0022 %% Info 0023 % Saved in a mat-file, anonymous functions cannot be restored so that they 0024 % have to be saved as string variables. This should works as long as they 0025 % do not contain anonymous functions themselves. 0026 0027 %% growth rate 0028 if isfield(pbeDef,'growthRate') 0029 pbeDef.growthRate = str2func(pbeDef.growthRate); 0030 end 0031 if isfield(pbeDef,'growthGrad') 0032 pbeDef.growthGrad = str2func(pbeDef.growthGrad); 0033 end 0034 0035 %% nucleation 0036 if isfield(pbeDef, 'nucleationRate') 0037 pbeDef.nucleationRate = str2func(pbeDef.nucleationRate); 0038 end 0039 0040 %% bulk 0041 if isfield(pbeDef, 'bulkRate') 0042 pbeDef.bulkRate = str2func(pbeDef.bulkRate); 0043 end 0044 0045 %% pivot property 0046 if isfield(pbeDef, 'pivotProperty') 0047 pbeDef.pivotProperty = str2func(pbeDef.pivotProperty); 0048 end 0049 0050 %% bulk property 0051 if isfield(pbeDef, 'bulkProperty') 0052 pbeDef.bulkProperty = str2func(pbeDef.bulkProperty); 0053 end