To select the indices of logical "1" in first 2D matrix, and then replace those corresponding indices in second 2D matrix with logical "0"
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Amjad Iqbal
el 18 de Mzo. de 2022
Comentada: Amjad Iqbal
el 18 de Mzo. de 2022
Dear Researchers and Programmers,
I have 2D matirx with logical 1, and 0. I need to select the indices having logical value 1.
Then in the second matrix, I want to replace those indices with zero.
I have attached both the matrices one is binary image and other is processed image.
I look forward to receive your valueable suggestions.
Many thanks.
0 comentarios
Respuesta aceptada
Cris LaPierre
el 18 de Mzo. de 2022
A = randi([0 3],5)
B = rand(5);
B(A==1) = 0
3 comentarios
Cris LaPierre
el 18 de Mzo. de 2022
If you are getting a logical output, you have not done what I showed. In my example, B is an array of doubles, not logicals. You use a logical array to perform the indexing (A==1). The assumption is that A and B are the same size.
Más respuestas (0)
Ver también
Categorías
Más información sobre Image Processing Toolbox en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!