Thread Subject: Is there a meshgrid function without a fixed variable size?

Subject: Is there a meshgrid function without a fixed variable size?

From: Robert

Date: 1 Apr, 2011 14:23:04

Message: 1 of 6

Hi,

I am trying to use meshgrid function on a vector with about 56000 variables and I get this message:

Maximum variable size allowed by the program is
exceeded.

Is there a way to go around that, maybe increase the variable size accepted by the program, or another function who accept a bigger number of variables?

Robert Toderascu.

Subject: Is there a meshgrid function without a fixed variable size?

From: Steven_Lord

Date: 1 Apr, 2011 14:53:44

Message: 2 of 6



"Robert " <toderascurobert@yahoo.com> wrote in message
news:in4n48$gkm$1@fred.mathworks.com...
> Hi,
>
> I am trying to use meshgrid function on a vector with about 56000
> variables and I get this message:
>
> Maximum variable size allowed by the program is
> exceeded.
>
> Is there a way to go around that, maybe increase the variable size
> accepted by the program, or another function who accept a bigger number of
> variables?

If you're using a 32-bit version of MATLAB, no.

If you're using a 64-bit version of MATLAB on a 64-bit OS you could
theoretically create a matrix this size ... but keep in mind that if both
the vectors you're passing into MESHGRID have 56000 elements, you're
creating a 56000-by-56000 real full double matrix that would require:

bytes = (56000*56000*8);
kb = bytes/1024;
mb = kb/1024;
gb = mb/1024

a contiguous block of memory over 23 GB in size to store. You'll probably
need several others contiguous blocks of the same size to actually perform
operations on such a matrix if you're performing the operations on the
matrix as a whole.

I suggest that rethinking your approach or breaking your problem into pieces
would be a good idea.

--
Steve Lord
slord@mathworks.com
To contact Technical Support use the Contact Us link on
http://www.mathworks.com

Subject: Is there a meshgrid function without a fixed variable size?

From: Robert

Date: 1 Apr, 2011 15:12:05

Message: 3 of 6

Thank you, unfortunately I have a 32 bits version, I will try a different approach.

Robert Toderascu.

Subject: Is there a meshgrid function without a fixed variable size?

From: Nasser M. Abbasi

Date: 1 Apr, 2011 15:12:27

Message: 4 of 6

On 4/1/2011 7:23 AM, Robert wrote:
> Hi,
>
> I am trying to use meshgrid function on a vector with about 56000 variables and I get this message:
>
> Maximum variable size allowed by the program is
> exceeded.
>

Is it really hard to show to command you used? WHat OS you have? how much
RAM you have? etc... I do not understand what you mean by

"meshgrid function on a vector with about 56000 variables"

a small example will help.

> Is there a way to go around that, maybe increase the variable size accepted by the program,
> or another function who accept a bigger number of variables?
>
> Robert Toderascu.

Well, I think the limit depends on what OS you have, 32 bit vs 64 bit vs 128 bit hardware,
if the OS can support extended ram or not, depends if the RAM you have is less than
what is needed, etc...

without more information, one will just have to guess.

give more info, may be someone can give you more exact answer.

--Nasser

Subject: Is there a meshgrid function without a fixed variable size?

From: Robert

Date: 1 Apr, 2011 15:33:04

Message: 5 of 6

"Nasser M. Abbasi" <nma@12000.org> wrote in message <in4q0r$h83$1@speranza.aioe.org>...
> On 4/1/2011 7:23 AM, Robert wrote:
> > Hi,
> >
> > I am trying to use meshgrid function on a vector with about 56000 variables and I get this message:
> >
> > Maximum variable size allowed by the program is
> > exceeded.
> >
>
> Is it really hard to show to command you used? WHat OS you have? how much
> RAM you have? etc... I do not understand what you mean by
>
> "meshgrid function on a vector with about 56000 variables"
>
> a small example will help.
>
> > Is there a way to go around that, maybe increase the variable size accepted by the program,
> > or another function who accept a bigger number of variables?
> >
> > Robert Toderascu.
>
> Well, I think the limit depends on what OS you have, 32 bit vs 64 bit vs 128 bit hardware,
> if the OS can support extended ram or not, depends if the RAM you have is less than
> what is needed, etc...
>
> without more information, one will just have to guess.
>
> give more info, may be someone can give you more exact answer.
>
> --Nasser

ok, I have a windows seven ultimate on 32 bits, matlab 2009b, on a 3Gb ram machine, with a 1.8 Ghz intel processor.
Now, I am trying to make a script to export the content of a text file to hdf5, and the file contains data like: latitude, longitude and depth, on three columns. I have to respect a specific format while writing the hdf5 file, now for the latitude and the longitude meshgrid worked perfectly, but when I am trying for depth I get that error. Since I am exporting in hdf5 format for a grid with 150*375 cells, the depth size is 56250. the problem appears when I am trying to arrange the depth data
this is a part of the code:

[LAT]=meshgrid(yi);
[LON]=meshgrid(xi);
[DEPTH]=meshgrid(zi);

where xi is longitude and yi is latitude, zi being the depth values.
now the question is how to put the depth values in a grid with 150*375 cells?

Robert Toderascu.

Subject: Is there a meshgrid function without a fixed variable size?

From: Steven_Lord

Date: 1 Apr, 2011 16:55:50

Message: 6 of 6



"Robert " <toderascurobert@yahoo.com> wrote in message
news:in4r7g$a01$1@fred.mathworks.com...
> "Nasser M. Abbasi" <nma@12000.org> wrote in message
> <in4q0r$h83$1@speranza.aioe.org>...
>> On 4/1/2011 7:23 AM, Robert wrote:

*snip*

> ok, I have a windows seven ultimate on 32 bits, matlab 2009b, on a 3Gb ram
> machine, with a 1.8 Ghz intel processor.
> Now, I am trying to make a script to export the content of a text file to
> hdf5, and the file contains data like: latitude, longitude and depth, on
> three columns. I have to respect a specific format while writing the hdf5
> file, now for the latitude and the longitude meshgrid worked perfectly,
> but when I am trying for depth I get that error. Since I am exporting in
> hdf5 format for a grid with 150*375 cells, the depth size is 56250. the
> problem appears when I am trying to arrange the depth data
> this is a part of the code:
>
> [LAT]=meshgrid(yi);

This may not be doing what you expect. This is equivalent to:

LAT = meshgrid(yi, yi);

> [LON]=meshgrid(xi);
> [DEPTH]=meshgrid(zi);
>
> where xi is longitude and yi is latitude, zi being the depth values.
> now the question is how to put the depth values in a grid with 150*375
> cells?

So what size, exactly, are xi, yi, and zi? If xi has 150 elements and yi has
375 elements (or vice versa) then you want to call MESHGRID once with two
inputs, xi and yi, then RESHAPE zi to be the same shape (150-by-375 or
375-by-150) as the outputs from MESHGRID.

--
Steve Lord
slord@mathworks.com
To contact Technical Support use the Contact Us link on
http://www.mathworks.com

Tags for this Thread

Everyone's Tags:

Add a New Tag:

Separated by commas
Ex.: root locus, bode

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.

Tag Activity for This Thread
Tag Applied By Date/Time
meshgrid maximu... Robert 1 Apr, 2011 10:24:32
rssFeed for this Thread

Contact us at files@mathworks.com