Thread Subject: breaking up a large matrix before loading into matlab

Subject: breaking up a large matrix before loading into matlab

From: gary12345

Date: 2 Jul, 2009 21:04:38

Message: 1 of 9

Does anybody know how I can load parts of a matrix into matlab instead of all at once? because matlab won't allow me to load it all at once because the matrix is too big. Thanks.

Subject: breaking up a large matrix before loading into matlab

From: dpb

Date: 2 Jul, 2009 23:41:52

Message: 2 of 9

gary12345 wrote:
> Does anybody know how I can load parts of a matrix into matlab
> instead of all at once? because matlab won't allow me to load it all
> at once because the matrix is too big. Thanks.

If it's a binary or text file see the doc for the appropriate input
function--they have optional arguments to include number of elements to
read.

If some other ML system did a SAVE to a .MAT file, there I'm not sure
outside a mex file or other hack to get at the data around the structure
of the file that there is...

--

Subject: breaking up a large matrix before loading into matlab

From: Sprinceana

Date: 3 Jul, 2009 06:28:01

Message: 3 of 9

For example if your big matrix (stored in variable) is 720x960 and you want to load only 10*10:


img=imread('poza.jpg');imshow(img);


>>whos img

  Name Size Bytes Class

  img 720x960 691200 uint8 array

Make this (to store only 10*10 part of that matrix):

small_img=img(1:10,1:10);
imagesc(small_img);

Subject: breaking up a large matrix before loading into matlab

From: us

Date: 3 Jul, 2009 06:44:01

Message: 4 of 9

"Sprinceana " <mihaispr@yahoo.com> wrote in message <h2k8dh$6uc$1@fred.mathworks.com>...
> For example if your big matrix (stored in variable) is 720x960 and you want to load only 10*10:
>
>
> img=imread('poza.jpg');imshow(img);
>
>
> >>whos img
>
> Name Size Bytes Class
>
> img 720x960 691200 uint8 array
>
> Make this (to store only 10*10 part of that matrix):
>
> small_img=img(1:10,1:10);
> imagesc(small_img);

SO... you end up having the BIG -AND- the SMALL matrix in your workspace...
how does this help the OP...

us

Subject: breaking up a large matrix before loading into matlab

From: us

Date: 3 Jul, 2009 06:45:03

Message: 5 of 9

gary12345 <garycyhou@yahoo.ca> wrote in message <18789979.66027.1246568708618.JavaMail.jakarta@nitrogen.mathforum.org>...
> Does anybody know how I can load parts of a matrix into matlab instead of all at once? because matlab won't allow me to load it all at once because the matrix is too big. Thanks.

a hint:

     help memmapfile;

us

Subject: breaking up a large matrix before loading into matlab

From: Bruno Luong

Date: 3 Jul, 2009 06:48:01

Message: 6 of 9

dpb <none@non.net> wrote in message <h2jh0c$edq$2@news.eternal-september.org>...
> gary12345 wrote:
> > Does anybody know how I can load parts of a matrix into matlab
> > instead of all at once? because matlab won't allow me to load it all
> > at once because the matrix is too big. Thanks.
>
> If it's a binary or text file see the doc for the appropriate input
> function--they have optional arguments to include number of elements to
> read.
>
> If some other ML system did a SAVE to a .MAT file, there I'm not sure
> outside a mex file or other hack to get at the data around the structure
> of the file that there is...

I have not seen he internal format of MAT file documented anywhere. Not sure how to hack it.

Best recommendation is to find a computer with Matlab and large RAM to break down the file.

Few possible attempts: Try first to load the file after CLEAR ALL command. It is possible that the SAVE command is carried out on the same computer with large data-sharing variables. LOAD - since unshared them - thus will be unable to read it on the very same computer. In this case load individual variables separately - interleaved with clear all - might work. If it doesn't pass, then you are screwed.

Bruno

Subject: breaking up a large matrix before loading into matlab

From: us

Date: 3 Jul, 2009 06:55:04

Message: 7 of 9

"Bruno Luong" <b.luong@fogale.findmycountry> wrote in message <h2k9j1$l96$1@fred.mathworks.com>...
> dpb <none@non.net> wrote in message <h2jh0c$edq$2@news.eternal-september.org>...
> > gary12345 wrote:
> > > Does anybody know how I can load parts of a matrix into matlab
> > > instead of all at once? because matlab won't allow me to load it all
> > > at once because the matrix is too big. Thanks.
> >
> > If it's a binary or text file see the doc for the appropriate input
> > function--they have optional arguments to include number of elements to
> > read.
> >
> > If some other ML system did a SAVE to a .MAT file, there I'm not sure
> > outside a mex file or other hack to get at the data around the structure
> > of the file that there is...
>
> I have not seen he internal format of MAT file documented anywhere. Not sure how to hack it.
>
> Best recommendation is to find a computer with Matlab and large RAM to break down the file.
>
> Few possible attempts: Try first to load the file after CLEAR ALL command. It is possible that the SAVE command is carried out on the same computer with large data-sharing variables. LOAD - since unshared them - thus will be unable to read it on the very same computer. In this case load individual variables separately - interleaved with clear all - might work. If it doesn't pass, then you are screwed.
>
> Bruno

hm... i didn't think the OP was talking about a MAT-file...
anyhow, here's the doc describing the anatomy of a MAT...

http://www.mathworks.com/access/helpdesk/help/pdf_doc/matlab/matfile_format.pdf

us

Subject: breaking up a large matrix before loading into matlab

From: Bruno Luong

Date: 3 Jul, 2009 07:04:02

Message: 8 of 9

"us " <us@neurol.unizh.ch> wrote in message <h2ka08$hoq$1@fred.mathworks.com>...

> here's the doc describing the anatomy of a MAT...
>
> http://www.mathworks.com/access/helpdesk/help/pdf_doc/matlab/matfile_format.pdf

Ah great, thank you usrs!!

Bruno

Subject: breaking up a large matrix before loading into matlab

From: Rune Allnor

Date: 3 Jul, 2009 09:31:19

Message: 9 of 9

On 2 Jul, 23:04, gary12345 <garycy...@yahoo.ca> wrote:
> Does anybody know how I can load parts of a matrix into matlab instead of all at once? because matlab won't allow me to load it all at once because the matrix is too big. Thanks.

If you have a wintel multi-core PC, then try this:

- Push <ctrl>-<alt>-<del> to bring up the task manager
- Right-click on the matlab process in the processes view
- Select 'set affinity...' in the pop-up menu
- De-select CPU0
- Press 'OK'

This will cause the matlab process to be run on one
of the other cores available. With a little luck,
the OS and most of the other processes run on CPU0
core, meaning lots of the memory associated with this
core is not available to matlab.

If this doesn't work, try the same again but deselect
some other core.

Rune

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
reference us 3 Jul, 2009 02:49:15
imagesc Sprinceana 3 Jul, 2009 02:29:04
big matrix Sprinceana 2 Jul, 2009 17:29:23
rssFeed for this Thread
 

MATLAB Central Terms of Use

NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Terms prior to use.

Contact us at files@mathworks.com