If a matrix contains 1's and 0's ,i would like to get only those 1's and want to take avg values of those corresponding intensity values
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
senthil vadivu
am 20 Nov. 2016
Beantwortet: Image Analyst
am 20 Nov. 2016
If a matrix contains 1's and 0's ,i would like to get only those 1's and want to take avg values of those corresponding intensity values
1 Kommentar
Jan
am 20 Nov. 2016
Which intensity values? The average of the ones in a matrix is 1.0, so what is "corresponding" here?
Akzeptierte Antwort
KSSV
am 20 Nov. 2016
Let a be your vector which have 0 and 1.
% get indices of 1
idx = a(a==1);
Let b be your intensity values corresponding to a.
% extract inentisity values of positions 1
b_1 = b(idx);
0 Kommentare
Weitere Antworten (1)
Image Analyst
am 20 Nov. 2016
If matrix1 is your matrix of 0's and 1's, and matrix2 is your intensity matrix, you can get the mean intensity of matrix2 only where the values of matrix1 are 1 like this:
theMean = mean(matrix2(matrix1));
0 Kommentare
Siehe auch
Kategorien
Mehr zu Logical finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!