I need a matlab m-file for a simulink matlab function call block. The m-file should consist of two main sub-threads, one for calculating a Vector Autoregression response for estimating the next 120 time steps, based on a var or arma model. The second thread updates the VAR/ARMA model every 10 seconds. The m-file should support real time execution, and output updated results every 0.25 or 0.5 sec. There are three parts to this question, 1) the framework for two separate threads running, and one of the tread having multiple sub-threads for updating each of the var models, 2) the update of a collection of var models every 10 s, 3) and the evaluation of the collection of var models for forecasting a large number of time steps. I'm currently using armax in the matlab environment, but need to switch to simulink.