A matrix theory of elastic-locking structures