MATLAB: Error when calling a previously made function in a separate script. Any ideas

calling another function

I keep getting an Error when calling a previously made function that was made in a separate script, even when it is on my path. This piece of code performs a multiple regression iterative search task with 3 parameters.
Here is the original function that gets called later(Both original function script and the other Script it is being called in are attached) I created the function that is being called myself.
Open each attachment separately and run iterative search script to see error.

Best Answer

The problem is caused by this line
WR = table(RedBloodCellCount,MeanWBCM30,'variablenames',{'RedBloodCellCount','MeanWBCM30'});% 2 previosly defined varibles are put into a table.

The function MultipleRegression require tables with field WhiteBloodCellCount and RedBloodCellCount, which the table WR does not contain. Change the 2nd variable name to WhiteBloodCellCount and it will give no syntax error.
WR = table(RedBloodCellCount,MeanWBCM30,'variablenames',{'RedBloodCellCount','WhiteBloodCellCount'});% 2 previosly defined varibles are put into a table.
*** "the following passage is just a suggestion based on observing your code, you may ignore it if you are sure about what you are doing."
It appears that you are making a logical mistake in your code. The new table WR contain the same value for WhiteBloodCellCount, so it might not be a good way to evaluate the performance of [Bestparams1, Bestparams2, Bestparams3]. It might be better to compare the parameters based on the original Data table as follow
Curve = MultipleRegression([Bestparams1,Bestparams2,Bestparams3], Data);
Also as I mentioned in Answer to your previous question, the line
SSD = A(:,3)-SimulatedY.^2; %calculate squared deviations at each data point in column 3 of data table (the row labelled IQ). Column 3 represents Y values.
is definitely wrong which is also indicated by your comment after the line. The correct is
SSD = (A(:,3)-SimulatedY).^2;
Hope this will help.