make xref more efficient, write to .m file

From @MichelJuillard

For large models it is really slow. I think that we should

  1. add an Dynare option to compute them and write them in *.m file (unless it is required for a particular computation, but it is not yet the case)
  2. change the Matlab code: {end+1} is very elegant but very inefficient because Matlab makes memory allocations several times. It is better to initialize first the cellarray and use an index for the assignment. The size is M_.endo_nbr and M_.eq_nbr