필터 지우기
필터 지우기

seleting some part of matrix

조회 수: 1 (최근 30일)
Andrea
Andrea 2012년 5월 30일
Q = randi(456,10,15);
row=[1 2 5 4 3 6];
column=[5 7 3 4 8 14];
p = Q(row,column);
P = zeros(size(Q));
P(1:numel(row),1:numel(column)) = p;
The problem is:
I need matrix p to have Q(row(1),column(1)), Q(row(1),column(1)), Q(row(2),column(2)), Q(row(3),column(3)), Q(row(4),column(4)), Q(row(5),column(5)), and Q(row(6),column(6)). But what (p = Q(row,column);) give me is a 6*6 matrix in this way Q(row(1),column(1)), Q(row(1),column(2)), Q(row(1),column(3)), Q(row(1),column(4)), and..... How can solve this problem?
  댓글 수: 1
Andrei Bobrov
Andrei Bobrov 2012년 5월 31일
double
http://www.mathworks.com/matlabcentral/answers/39877-put-smaller-matrix-in-bigger-matrix

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

답변 (1개)

Walter Roberson
Walter Roberson 2012년 5월 31일
Q( subs2ind(size(P), row, column) )

카테고리

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

제품

Community Treasure Hunt

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

Start Hunting!

Translated by