two random number columns

조회 수: 8 (최근 30일)
abdul rehman
abdul rehman 2020년 7월 13일
댓글: abdul rehman 2020년 7월 13일
I need to genarate a series of random number from 0 to 1 using rand(5,1). against same list I need a random list of 0 and1 in second column Both must be assocated so I can use in program
e.g
0.1058 0
0.1097 0
0.0636 1
0.4046 1
0.4484 0

채택된 답변

madhan ravi
madhan ravi 2020년 7월 13일
[rand(5, 1), randi([0, 1], 5, 1)]
  댓글 수: 3
madhan ravi
madhan ravi 2020년 7월 13일
a = [rand(5, 1), randi([0, 1], 5, 1)];
a(a(:,2) == 1, :) % are the ones satisfying the conditions
abdul rehman
abdul rehman 2020년 7월 13일
thank you so much

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Correlation and Convolution에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by