My problem here is that if I were to run the following code without the for loop and a fixed value for rtemp, then the variable ExpectedReturn is a 1x1 double.
ExpectedReturn = zeros(size(r));
for i = 1:size(r)
Rtemp = r(i);
b = ones(25,1).*(Rtemp*C);
b = [b;C];
However, if I were to run it as is, with the value of rtemp varying, I get this error:
In an assignment A(:) = B, the number of elements in A and B must be the same.
Error in PortfolioOpt (line 54)
Since I am storing a 1x1 double in ExpectedReturn(i), why does it say the dimensions don't match?