How to create discrete variable??

조회 수: 4 (최근 30일)
Triveni
Triveni 2015년 12월 17일
댓글: Triveni 2015년 12월 17일
I have to create discrete matrix
A(:,:,k) = [a b c d e f g h i j k l m n o p];
for k= 1:N
i want to allocate a b c... from matrix [0 10 20 30 40] only. How can i allocate randomly a b c...
please help me

채택된 답변

Guillaume
Guillaume 2015년 12월 17일
I'm not entirely clear on what you're asking. This may do what you want:
valuepool = [0 10 20 30 40];
N = 2;
randidx = randi(numel(valuepool), [16 16 N]);
A = valuepool(randidx)
  댓글 수: 1
Triveni
Triveni 2015년 12월 17일
Sorry .....very sorry

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Get Started with Optimization Toolbox에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by