An efficient way to create a 2D array.
Afficher commentaires plus anciens
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 commentaires
David Sanchez
le 20 Juin 2013
who do you consider the neighbour pixel(s)? Only the pixel next to the current pixel (left, right, both) ?
Khurram
le 20 Juin 2013
Réponses (0)
Catégories
En savoir plus sur Multidimensional Arrays dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!