An efficient way to create a 2D array.
Mostrar comentarios más antiguos
Hey everyone, I am new to matlab. Here is my question:
Suppose, I = [a b c d e; f g h i j; k l m n o; p q r s t];
If (I(current pixel) == I(neighbour pixel)) then E(current pixel,neighbor pixel) = 1; else E(current pixel, neighbor pixel) = 0;
whereas a neighbor pixel is any pixel in 3x3 window centered at the current pixel. (I think this convention is know as the 8-neighbor)
One possible way is to use doubly nested for loop. Is there any more efficient way (using any of these (<http://www.mathworks.com/help/matlab/elementary-matrices-and-arrays.html>) data structure) and please write a hint how to use it since I cannot figure it out by myself.
2 comentarios
David Sanchez
el 20 de Jun. de 2013
who do you consider the neighbour pixel(s)? Only the pixel next to the current pixel (left, right, both) ?
Khurram
el 20 de Jun. de 2013
Respuestas (0)
Categorías
Más información sobre Multidimensional Arrays en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!