I am building a simple automated stock trading system. I can enter trades that will not be executed until certain criteria are met. I am trying to check every minute if any of the potential trades have met their criteria. This is done with a timer object initialized in the app calling a function that calls a script from a different file. I tried doing this calling the script directly but had no success. I think it is because the vector that holds all possible trades is changing in size.
function startupFcn(app) app.allTrades = []; setGlobalT([]); t = timer('StartDelay', 0, 'Period', 5, 'ExecutionMode', 'fixedRate','TimerFcn',@myFun); start(t); function myFun(obj, event) AWS(app.allTrades); end end
The AWS script is the one that does the checking. The code is below.
function AWS(allTrades)disp('in AWS');for i=1:length(allTrades) disp('in for'); DOIT = 0; DOIT = act(allTrades(i)); if DOIT == 1 allTrades(i) = []; endendend
Best Answer