2D pattern matching
- To: mathgroup at smc.vnet.net
- Subject: [mg77140] 2D pattern matching
- From: "alexxx.magni at gmail.com" <alexxx.magni at gmail.com>
- Date: Tue, 5 Jun 2007 06:24:23 -0400 (EDT)
hi everybody, do you know how to do a pattern match involving 2D matrices? If e.g. you have a list a = {{0, 0, 0, 0, 0, 0}, {0, 1, 0, 0, 0, 0}, {0, 1, 0, 1, 1, 0}, {0, 0, 0, 1, 1, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}} i.e. 0 0 0 0 0 0 0 1 0 0 0 0 0 1 0 1 1 0 0 0 0 1 1 0 0 0 0 0 0 0 is it possible for me to write a rule by which I am able to find the 2x2 square of 1's, and replace it with something else? I studied all I could on patterns, but didnt find an answer... thanks for ANY help Alessandro Magni
- Follow-Ups:
- Re: 2D pattern matching
- From: János <janos.lobb@yale.edu>
- Re: 2D pattern matching