Prevent repeating number in any matrix row

Hi all, If I have any random matrix: [2 4 5 6 4; 3 5 3 2 6] The numbers 4 and 3 are repeated in rows one and two, respectively. I would like some help in being able to prevent this repeating. The randperm function is okay for doing the requirement in vectors. Is it okay here in a matrix? your help is appreciated. Hany

Answers (1)

[~,out] = sort(rand(2,5),2);

1 Comment

Thanks sir. how to determine the lower and upper limits for the random numbers?

This question is closed.

Tags

Asked:

on 12 Jul 2017

Closed:

on 20 Aug 2021

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!