필터 지우기
필터 지우기

Please help me in generating multiple matrices

조회 수: 1 (최근 30일)
MANISH KUMAR
MANISH KUMAR 2016년 6월 27일
편집: Stephen23 2016년 6월 27일
this code is for one matrix X, but I want N = 5 such matrices
N = 5; % No. of matrices
P = 5; % The number of rows
T = 10; % The number of columns
% Duration of projects
D = [4; 5; 3; 2; 4];
excludedcount = D-1;
X = zeros(P,T);
for row = 1:P
rv = [1, zeros(1, T - excludedcount(row) - 1)];
X(row, 1 : (T - excludedcount(row))) = rv(randperm(numel(rv)));
end

답변 (1개)

Walter Roberson
Walter Roberson 2016년 6월 27일

카테고리

Help CenterFile Exchange에서 Multidimensional Arrays에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by