Later in 1638 , the grandson of Tokugawa Ieyasu , Matsudaira Naomasa entered the castle because the Horio clan had no heir . Matsudaira 's family ruled until the end of the han system . Later in 1638 , the grandson of Tokugawa Ieyasu , Matsudaira Naomasa enters the castle since the Horio clan had no heir , and his family ruled until the abolition of the han system .