I would like to store the data from a double loop in a matrix (not a cell). I tried the following code (the function used in the inner loop here is just an example).
valuesforOPratio = zeros(41,1);
valuesforM = zeros(41,61);
NPVtotal=1;
for M = 40:100
for OPratio = 30:70;
NPVtotal = NPVtotal+1
valuesforOPratio(OPratio)=NPVtotal;
end
valuesforM(M) = valuesforOPratio
end
I get the following error:
In an assignment A(:) = B, the number of elements in A and B must be the same.
Error in sensitivity_opratio (line 10)
valuesforM(M) = valuesforOPratio
Any help on how to store the data in a matrix ? I guess this is rather easy but I am not getting there