Update matrix