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:
Best way to code this using loops ?

Subject: Best way to code this using loops ?

From: DRG

Date: 21 Jun, 2012 10:59:20

Message: 1 of 2

Hello..

I have a 10,000 by 10,000 grid. Initially, all of array is set to zero. The following rules then apply

(1) A random cell is selected in that array and set to a value of 1

(2) In the next loop, that cell has a daughter cell which goes immediately adjacent to the original cell, so in a randomly selected (x +/- 1, y +/- 1) position.

(3) This keeps repeating, with the exception that if a cell divides and there is already offspring in the randomly selected cell, that cell already in that position is moved to an adjacent cell.

(4) Whole process repeats 100 times

Any ideas on how to code this for maximum efficiency ?

Thank you in advance!

Subject: Best way to code this using loops ?

From: DRG

Date: 21 Jun, 2012 11:00:22

Message: 2 of 2

On Thursday, June 21, 2012 11:59:20 AM UTC+1, DRG wrote:
> Hello..
>
> I have a 10,000 by 10,000 grid. Initially, all of array is set to zero. The following rules then apply
>
> (1) A random cell is selected in that array and set to a value of 1
>
Actually, I should clarify; this step only happens the first time. Steps 2-4 are repeated next 100 iterations!

Tags for this Thread

No tags are associated with 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