0001
0002
0003
0004
0005
0006
0007
0008
0009 function [ theCoefficient ] = generateCoefficientEquationFromString( chr )
0010
0011 chr = strrep(chr,'+ ','+');
0012 chr = strrep(chr,'- ','-');
0013 pieces = strsplit(' ',chr);
0014
0015 i = 1;
0016 index = 1;
0017 coefficient = pieces(1);
0018 found = false;
0019 while i <= length(pieces)
0020 actualPiece = pieces(i);
0021 if cellfun(@isempty,strfind(actualPiece,'/'))==true
0022 coefficient(index) = actualPiece;
0023 index = index+1;
0024 found = true;
0025 end
0026 i = i + 1;
0027 end
0028
0029 if found == true
0030 theCoefficient = char(coefficient(1));
0031 match = 2;
0032 while match <= length(coefficient)
0033 theCoefficient = strcat(theCoefficient,char(coefficient(match)));
0034 match = match + 1;
0035 end
0036 else
0037 theCoefficient = 0;
0038 end
0039
0040 return;
0041
0042 end