필터 지우기
필터 지우기

make an r by m permutation matrix

조회 수: 1 (최근 30일)
fadams18
fadams18 2021년 4월 6일
편집: fadams18 2021년 4월 6일
I have the following code :
A = eye(r);
L = [];
for i = 1:10
A = A(randperm(r),:);
L = [L A]; % 10 x 100 matrix with only one nonzero entry per column
end
The variable L is a 10x 100 size matrix. however i want to make a more intelligent code such that,
the dimensions will depend on the dimension of an input data matrix. for example when i input X, i.e.
% r is my rank. m and n are the dimensions.
X = rand(m,r)* rand(r,n);
% I want L to have dimension of [m by r] or [r by n] .
% i.e. it should pick on of the sides of X and the other side r

답변 (0개)

카테고리

Help CenterFile Exchange에서 Operating on Diagonal Matrices에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by