フィルターのクリア

Info

この質問は閉じられています。 編集または回答するには再度開いてください。

For else error and vector integration

1 回表示 (過去 30 日間)
Tomasz Mlynowski
Tomasz Mlynowski 2012 年 7 月 7 日
閉鎖済み: MATLAB Answer Bot 2021 年 8 月 20 日
I am trying to convert a (for if else) condition into a vector. I am having problems running the results after because I need to redefine the different Short and Long trades to be read as directionTrade i think. not sure what I am doing incorrectly.
I need to convert: -
if dist(k,i)>0
B_Short(k,i)=-1;
B_Long(k,p(i,1))=+1;
else
B_Short(k,p(i,1))=-1;
B_Long(k,i)=+1;
end
INTO......................
for i=1:length(idx)
if (dist(k,idx(i))>0)
myTrades{idxTrades,1}.directionTrade1=[-1 1];
else
myTrades{idxTrades,1}.directionTrade2=[ 1 -1];
Attempted added information Below. Not sure if correct...
directionTrade1=[B_Short(k,i) B_Long(k,p(i,1))];
directionTrade2=[B_Long(k,i) B_Short(k,p(i,1))];
This is where the problem arises.
% Calculation of the Total Buy_Signs Matrix
BsignsT(k,:)=B_Long(k,:)+B_Short(k,:);
Because it still reads B Long and B Short trades however I want to replace with the above vector else conditon. What do I need to change? and what do I need to change the name to for all recurrences of B Short and B Long in the remaining code for it to correctly read the newly changed vector and process the fucntion correctly..???

回答 (0 件)

この質問は閉じられています。

Community Treasure Hunt

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

Start Hunting!

Translated by