Thread Subject: deleting variables in .mat file

Subject: deleting variables in .mat file

From: Henrik

Date: 12 Sep, 2007 22:56:16

Message: 1 of 4

I was wondering if there is a way of deleting a specific
variable in a .mat file with a lot of variables in without
having to load them to a workspace first and then delete the
variable and save the rest of them again. So I need a
function that looks into a .mat file and delete the variable
I was looking for and then re-save the updated .mat file.

Thank you for your help
HS

Subject: deleting variables in .mat file

From: us

Date: 12 Sep, 2007 23:04:40

Message: 2 of 4

Henrik:
<SNIP running out of luck (1987, m jagger, d hopper, et
al)...

> I was wondering if there is a way of deleting a specific
> variable in a .mat file...

no
us

Subject: deleting variables in .mat file

From: Dan

Date: 13 Sep, 2007 01:05:01

Message: 3 of 4

"Henrik " <henrikNOSPAM@lanl.gov> wrote in message
<fc9qqg$onc$1@fred.mathworks.com>...
> I was wondering if there is a way of deleting a specific
> variable in a .mat file with a lot of variables in without
> having to load them to a workspace first and then delete
the
> variable and save the rest of them again. So I need a
> function that looks into a .mat file and delete the
variable
> I was looking for and then re-save the updated .mat file.
>
> Thank you for your help
> HS

There is a function that can be called from a mex file
called matDeleteVariable that should work. There is a mex
function on the file exchange at http://www.mathworks.com/
matlabcentral/fileexchange/
loadFile.do?objectId=162&objectType=file you just have to
change matDeleteArray to matDeleteVariable and then compile
it. I tried this on a large mat file with lots of variables
and it seemed pretty slow to me but it does work.

Dan

Subject: deleting variables in .mat file

From: Henrik

Date: 13 Sep, 2007 15:54:56

Message: 4 of 4

Thank you for your help.

Chhers
HS

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
delete Henrik 12 Sep, 2007 19:00:04
mat Henrik 12 Sep, 2007 19:00:04
variable Henrik 12 Sep, 2007 19:00:04
rssFeed for this Thread

Contact us at files@mathworks.com