From where can we get the historical data for backtesting on matlab?

If you are looking for End of the day historical data you can directly download the bhavcopy from nseindian.com official website,

If you are looking for minute data you can get it from private data vendors like neotradeanalytics, esignal etc.,