randi(12,4,3)
>>3 4 2
3 5 5
2 3 4
1 2 3
i want non repeated value in row only which command can i use?????????
[Merged from duplicate]
>>randi(12,4,3)
>>3 4 5;
2 4 2;
1 2 3;
7 8 9
As above the result in second row the 2 number is repeated in same row,In 2nd column has the 4 is repeated friends...........
My requirements is I WANT NON REPEATED VALUE IN ROW ONLY which command can i use sir...............

 채택된 답변

Walter Roberson
Walter Roberson 2017년 12월 2일

0 개 추천

You can use randperm(12,3) repeatedly.

댓글 수: 3

VIJAY
VIJAY 2017년 12월 2일
Ya sure sir but randperm(12,3) creates a single row sir.Is it possible to create a array size as 4*5
VIJAY
VIJAY 2017년 12월 2일
for t=1:4 g(t,:)=randperm(12,5); end
But is it possible to use a single command sir????
Walter Roberson
Walter Roberson 2017년 12월 2일
It can be done without a loop but requires 2 commands:
[~, g] = sort( rand(4, 12), 2 );
g = g(:, 1:3);

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Logical에 대해 자세히 알아보기

태그

질문:

2017년 12월 2일

댓글:

2017년 12월 2일

Community Treasure Hunt

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

Start Hunting!

Translated by