To generate the numbers from random locations, without repeating any of the locations you need to use randperm(), not randi() like other answer(s). Using randi() will potentially allow the same location to be used multiple times. So use randperm() or randi() depending on what you want.
randomIndexes = randperm(numel(m), 10)
extractedNumbers = m(randomIndexes)