Path: news.mathworks.com!newsfeed-00.mathworks.com!newsfeed2.dallas1.level3.net!news.level3.com!postnews.google.com!r10g2000prf.googlegroups.com!not-for-mail
From: Rune Allnor <allnor@tele.ntnu.no>
Newsgroups: comp.soft-sys.matlab
Subject: Re: how to rename a workspace variable in a loop?
Date: Wed, 17 Dec 2008 11:51:33 -0800 (PST)
Organization: http://groups.google.com
Lines: 41
Message-ID: <9cb226e9-a0db-4d29-93ce-dfe0416fb1fe@r10g2000prf.googlegroups.com>
References: <f7olca$1mj$1@fred.mathworks.com> <f7om7m$dvb$1@fred.mathworks.com> 
	<gi9c71$c2a$1@fred.mathworks.com>
NNTP-Posting-Host: 77.17.126.19
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
X-Trace: posting.google.com 1229543493 17306 127.0.0.1 (17 Dec 2008 19:51:33 GMT)
X-Complaints-To: groups-abuse@google.com
NNTP-Posting-Date: Wed, 17 Dec 2008 19:51:33 +0000 (UTC)
Complaints-To: groups-abuse@google.com
Injection-Info: r10g2000prf.googlegroups.com; posting-host=77.17.126.19; 
	posting-account=VAp5gAkAAAAmkCze5hvZtMeedpZWNthI
User-Agent: G2/1.0
X-HTTP-UserAgent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET 
	CLR 2.0.50727; .NET CLR 3.0.04506.648; .NET CLR 3.5.21022),gzip(gfe),gzip(gfe)
Xref: news.mathworks.com comp.soft-sys.matlab:507597


On 17 Des, 00:05, "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().

You may be right about LOAD, but that doesn't mean that EVAL is
necessary; only that LOAD (or rather, the .mat interface) might
be flawed. I remember seeing some threads here a few months
ago where LOAD was modified to read specified variables from
a .mat file. Somebeody else requested the functionality you ask
for, so if you submit a product enhancement request to TMW
you might get this functionality in a later version of matlab.

In the mean time, you can easily avoid the problem by using some
other file format than .mat. The naive way would be to use a
binary format where the first entries are the (n,m,p) dimensions
of the image stored on some specified integer format, and then
the data stored on the relevant format as p consecutive (n,m)
frames. With this type of data format it would be no big deal
to read only parts of a larger image.

Such formats might already exist, for all I know. If so,
it would be a matter of obtaining the documentation for
the format (which might not be quite as easy as it sounds)
and implement an I/O interface.

Rune