I get an error in my for statement it says i need to add and end and i did

1 次查看(过去 30 天)
l_s=[];
% test a trade
for i=1:21
if abs(stock_t(3).price(i)-stock_t(5).price(i))>top5(1,4)
for ii=i:21
if stock_t(3).price(i)>stock_t(5).price(i)
l_s(i,1)=-1*stock_t(3).price(i);
l_s(i,2)=1*stock_t(5).price(i);
else
l_s(i,1)=-1*stock_t(3).price(i);
l_s(i,2)=1*stock_t(5).price(i);
end

采纳的回答

Walter Roberson
Walter Roberson 2017-11-21
MATLAB is not python. You need an end for the inner if, you need an end for the inner for, you need an end for the outer if, you need an end for the outer for -- four ends in total. You only have one end

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Call Python from MATLAB 的更多信息

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by