There are 2 types of Demat Accounts for NRIs - Repatriable and Non-Repatriable.
The Repatriable Demat Account is for all shares and securities that have been purchased using funds that are repatriable. On sale of these shares, the sale proceeds can be credited to your NRE Bank account.
The Non-Repatriable Demat Account is for all shares and securities that have been purchased using funds that are non-repatriable or purchased at the time when you were a Resident Indian. On sale of these shares, the sale proceeds can be credited to your NRO Bank account.