I am getting the error: "Subscript indices must either be real positive integers or logicals."
Is the fact that I have values as inputs and outputs that are decimals the issue?
Essentially, I call two matrices, M and N. Then I iterate through N, and depending on how N compares to something in M (less than, greater than, etc.), it puts the N value into an equation and outputs a value. Both the input from N and the output from the function are decimals.
I would like to fill priceB_values with the results of the for loop.
Is there something obvious that I'm missing?
priceB_values = zeros(1:4)
for i = N(1:4,6)
if i < M(3,6)
priceL_Opt1_Value = ((M(3,6)-M(3,5))/(M(1,6)-M(1,5)))*(priceB_Opt4-M(1,6))+M(3,6)
elseif i > M(1,6) || priceB_Opt4 < M(1,7)
priceL_Opt1_Value = ((M(3,7)-M(3,6))/(M(1,7)-M(1,6)))*(priceB_Opt4-M(1,7))+M(3,7)
elseif i > M(1,7) || priceB_Opt4 < M(1,8)
priceL_Opt1_Value = ((M(3,8)-M(3,7))/(M(1,8)-M(1,7)))*(priceB_Opt4-M(1,8))+M(3,8)
elseif i == M(1,5)
priceL_Opt1_Value = M(1,5)
elseif i == M(1,6)
priceL_Opt1_Value = M(1,6)
elseif i == M(1,7)
priceL_Opt1_Value = M(1,7)
else i == M(1,8)
priceL_Opt1_Value = M(3,8)
end
priceB_values(i) = priceL_Opt1_Value
end