MATLAB: “Attempt to reference field of non-structure array” error message

arrayerrorMATLAB

I have this code to calculate Value-at-Risk with Monte Carlo simulation
function mean_percentile=MCSimulation(num_sim,seed,p,input_file)
database=xlsread(input_file);
[row,col]=size(database);
percentili=zeros(row,seed);
for j=1:seed
for i=1:row
a=normrnd(database(i,1),database(i,2),1,num_sim);
percentili(i,j) = prctile(a(1,:),p);
clear a
end
randn('state',sum(100*clock));
end
mean_percentile=zeros(row,1);
for i=1:row
mean_percentile(i,1)=-mean(percentili(i,:));
end
clear database
end
but then when i try using it I have this error message:
Attempt to reference field of non-structure array.
Can anyone help me please?
thanks very much!

Best Answer

Input file names need to be quoted if they are literal strings.
mean_percentile=MCSimulation(2000,20,0.99,'r.xls')