Azzera filtri
Azzera filtri

how to find weighted matrix of a binary matrix of same size in image processing

1 visualizzazione (ultimi 30 giorni)
I have a matrix A like this;
A=[1 2 3 4 5;4 5 6 7 1;3 4 5 9 1; 7 8 9 2 4;1 5 9 5 2];
P is a binary matrix of same size of A; P =
0 1 0 1 0
1 0 0 1 0
0 1 0 0 0
1 1 0 1 1
0 0 0 0 1
I want to replace all 1 of P with the value of A at same index position without using for loop. How can I overcome this problem. Please help me.

Risposta accettata

Andrei Bobrov
Andrei Bobrov il 27 Ott 2014
Pnew = P.*A;

Più risposte (0)

Community Treasure Hunt

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

Start Hunting!

Translated by