Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: how to rename a workspace variable in a loop?
Date: Tue, 16 Dec 2008 23:34:02 +0000 (UTC)
Organization: Xoran Technologies
Lines: 31
Message-ID: <gi9dta$80j$1@fred.mathworks.com>
References: <f7olca$1mj$1@fred.mathworks.com> <f7om7m$dvb$1@fred.mathworks.com> <3223d164-db24-4ffd-ac94-b5b0ed67a57a@d42g2000prb.googlegroups.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: webapp-02-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1229470442 8211 172.30.248.37 (16 Dec 2008 23:34:02 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Tue, 16 Dec 2008 23:34:02 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1440443
Xref: news.mathworks.com comp.soft-sys.matlab:507405


Jomar Bueyes <jomarbueyes@hotmail.com> wrote in message <3223d164-db24-4ffd-ac94-b5b0ed67a57a@d42g2000prb.googlegroups.com>...
> On Dec 16, 6:05=A0pm, "Matt" <mjacobson.removet...@xorantech.com> wrote:
> > > Don't. =A0See question 4.6 in the newsgroup FAQ for some of the reasons=
>  you shouldn't do this and alternatives to doing this.
> >
> > >http://matlabwiki.mathworks.com/MATLAB_FAQ
> >
> > Since there's been some chatter about this topic on several threads, I th=
> ought I'd throw in a case where I think there is no recourse but to make dy=
> namically named variables.
> >
> > I''m in a situation where it would be really great to be able to save a l=
> arge array X to a .mat file but later to load back only pieces of X into th=
> e workspace. Imagine for instance that X is a large 3D image and later you =
> want to load in one slice at a time for some sort of slice-wise processing.
> >
> > Unfortunately, load() doesn't let you do this. So, the only alternative I=
>  can come up with is to save each slice of X to the .mat file as an individ=
> ual variable, dynamically created using eval().
> 
> Alternatively, you could dynamically create file names. Something
> file_0001.tif, file_0002.tif, ... and save the images with 'imwrite'
> as uncompressed 16-bit tiff. Then you read them as needed for 2D
> processesing.
> 
> HTH

That's not really what I'd prefer. For one thing, I think you want to have all the slices in the same file so that it's easier to transport around (okay, you could use .zip...)

Also, I'd really like it to be a .mat file so that I can pile in other related variables, like a structure variable that could act as a header...