Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
keep matrix entries connected

Subject: keep matrix entries connected

From: Emma Robertson

Date: 21 Feb, 2012 17:27:12

Message: 1 of 3

Hi,
I have a matrix, say A, which changes entries at each time step (subject to rules). E.g.,
At t = 0: A= [1 1 1 1 1 At t=1: A=[1 1 1 1 1
                        1 1 1 1 1 1 1 1 1 1
                        2 2 2 2 2 2 2 1 2 2
                        2 2 2 2 2] 2 2 2 2 2].

What I don't want happening is
A=[1 1 1 2 1
     1 1 1 1 1
     2 2 2 2 2
     2 2 1 2 2],
because the 1's and 2's represent biological cells and it would be unreasonable for a single cell to have two separate pieces.
Does anyone know of the most efficient less time consuming method which checks that this does not happen each time a matrix entry attempts to change (bear in mind that in actual fact A is a 150x150 matrix). In essence, I want to be able to draw a line around each biological cell (set of 1's,2's,...) without lifting my pencil. I hope I explained the problem clearly, however, feel free to post for clarifications.
Thanks in advance,
Emma

Subject: keep matrix entries connected

From: Emma Robertson

Date: 21 Feb, 2012 17:45:14

Message: 2 of 3

I didn't know how to edit the original post, but the first two matrices should read like this:

 At t = 0: A= [1 1 1 1 1
                         1 1 1 1 1
                         2 2 2 2 2
                         2 2 2 2 2]

 At t = 0: A= [1 1 1 1 1
                         1 1 1 1 1
                         2 2 1 2 2
                         2 2 2 2 2]

Subject: keep matrix entries connected

From: TideMan

Date: 21 Feb, 2012 21:03:11

Message: 3 of 3

On Feb 22, 6:27 am, "Emma Robertson" <m...@hotmail.co.uk> wrote:
> Hi,
> I have a matrix, say A, which changes entries at each time step (subject to rules). E.g.,
> At t = 0:      A= [1 1 1 1 1         At t=1:    A=[1 1 1 1 1
>                         1 1 1 1 1                            1 1 1 1 1
>                         2 2 2 2 2                            2 2 1 2 2
>                         2 2 2 2 2]                           2 2 2 2 2].
>
> What I don't want happening is
> A=[1 1 1 2 1
>      1 1 1 1 1
>      2 2 2 2 2
>      2 2 1 2 2],
> because the 1's and 2's represent biological cells and it would be unreasonable for a single cell to have two separate pieces.
> Does anyone know of the most efficient less time consuming method which checks that this does not happen each time a matrix entry attempts to change (bear in mind that in actual fact A is a 150x150 matrix).  In essence, I want to be able to draw a line around each biological cell (set of 1's,2's,...) without lifting my pencil.  I hope I explained the problem clearly, however, feel free to post for clarifications.
> Thanks in advance,
> Emma

IMHO, you should be including this rule in your biological model, not
fixing it up afterwards by post-processing. Presumably, at each time
step, your biological model calculates the state of each element in
the matrix, so why not include a rule that the element cannot change
if surrounding elements are in a different state?

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us