I am trying to find index of lowest value of sub matrix mA
from matrix A
. z
provides the index of lowest value in mA
. How i can translate this index value of mA
to the original matrix A
A = magic(11)
mA = A(3:5,5:7)
[~,rows] = min(mA)
[~,col] = min(min(mA))
z = [rows(col),col]
A=randi([-10 10],11,11)
n1=3;n2=5;d1=3;d2=3;
mA=A(n1:n1+d1-1,n2:n2+d2-1)
[v1,q1]=min(mA(:))
[m1,m2]=ind2sub(size(mA),q1);
z=[n1+m1-1 n2+m2-1]
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.