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:
Storing a complicated data structure

Subject: Storing a complicated data structure

From: Toan Cao

Date: 15 Nov, 2013 03:55:12

Message: 1 of 2

Hello,

I have an 2D array A consisting of M rows and N columns (A =[MxN]). In turn, each element of A stores a 2D coordinate (ex: A(i,j) =[x, y]).
In Matlab, what is the optimal way for storing this data structure ?
In my case, A is a huge 2D array (M>30000, N>30000).
Looking forwards to your help.
Thanks in advance!

Toan

Subject: Storing a complicated data structure

From: Nasser M. Abbasi

Date: 15 Nov, 2013 04:06:26

Message: 2 of 2

On 11/14/2013 9:55 PM, Toan Cao wrote:
> Hello,
>
> I have an 2D array A consisting of M rows and N columns (A =[MxN]).
>In turn, each element of A stores a 2D coordinate (ex: A(i,j) =[x, y]).
> In Matlab, what is the optimal way for storing this data structure ?
> In my case, A is a huge 2D array (M>30000, N>30000).
> Looking forwards to your help.
> Thanks in advance!
>
> Toan
>

This is no different than an image, isn't? But with RG only,
not RGB, So you can simply make a 3D matrix, of 2 pages only,
instead of 3 pages as the case with a colored image.

So A(1,1,1) will by the x-coordinate and A(1,1,2) will be the
y. This is for point (1,1). Same for point (1,2) , etc...

A=zeros(m,n,2)

But for m=n=30,000 that will require about 14 GB assuming
double. 7 GB for 32 bit. but RAM is not expensive these days ;)

It depends also if you need all the data in RAM at same time or
not. You did not say.

--Nasser

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