Modifing a specific matrix that is corresponding to an indexing matrix
조회 수: 1 (최근 30일)
이전 댓글 표시
Hello everyone,
I have an indexing matrix A and regular matrix B. Each row of A has only 1 (one), the position index of this 1 should be traced to the matrix B and multiplied by 10. For example,
A=[ 2 1 5 4 3;
3 2 1 4 5;
1 3 2 5 4;
2 5 4 1 3]
B=[53 530 53 53 53;
19 19 190 19 19;
550 55 55 55 55;
45 45 45 450 45]
Thank you in advance!
댓글 수: 3
채택된 답변
추가 답변 (1개)
Azzi Abdelmalek
2016년 4월 9일
I suppose your data are
A=[ 2 1 5 4 3;
3 2 1 4 5;
1 3 2 5 4;
2 5 4 1 3]
B=[53 53 53 53 53;
19 19 19 19 19;
55 55 55 55 55;
45 45 45 45 45]
% The code
idx=A==1
B(idx)=B(idx)*10
참고 항목
카테고리
Help Center 및 File Exchange에서 Matrix Indexing에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!