Probably what is happening is that, as it is being passed into Stateflow, the matrix has to be copied over and, once the C code is generated, that is a nested for loop with 50 x 1000 iterations.
My first thought is to look at whether you need the whole matrix at once. If not, you can just pass bits of the trajectory at a time.
Another thing you can try is to transpose the matrix to be 1000x50. This will improve your TET immediately (thought it might not be enough of a gain). MATLAB is a column major language https://en.wikipedia.org/wiki/Row-_and_column-major_order and it will be faster to traverse a matrix by going down the columns rather than across rows.
An alternative is you can write your own C to do this, rather than rely on the generated C and include that file among those generated (that's a more complicated thing to do but quite possible).
You could also contact Mathworks support and see if they have any ideas.
Please login or Register to submit your answer