function to get char matrix from selection with example