Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Convert .MAT data file to ASCII

1,177 views
Skip to first unread message

Tom Moriarty

unread,
Dec 3, 2010, 6:32:05 PM12/3/10
to
Hi,
I hope the Matlab community can help me out.

I am not a Matlab user, but I have a Matlab data file (.MAT file) from the online supplemental information of a Proceedings of the National Academy of Sciences (PNAS)article. The file is about half a megabyte.

I would like to convert this file to an ASCII format, so I can read it. Is there a utility that would do this conversion? Or could somebody do the conversion for me? Any help would be greatly appreciated.

Thanks,
Tom

Walter Roberson

unread,
Dec 3, 2010, 8:38:21 PM12/3/10
to
On 03/12/10 5:32 PM, Tom Moriarty wrote:

> I am not a Matlab user, but I have a Matlab data file (.MAT file) from
> the online supplemental information of a Proceedings of the National
> Academy of Sciences (PNAS)article. The file is about half a megabyte.

> I would like to convert this file to an ASCII format, so I can read it.

In the general case, .mat files could contain objects for which there is
no ASCII representation. This includes graphics objects and some kinds
of objects having to do with object-oriented programming (as the process
of reading the object is allowed to trigger changes in the object.)

If the data is numeric, double precision, and has more than about two
columns, representing it _exactly_ in ASCII becomes tedious to read...
up to 58 columns per value. However, given the details of a particular
rounding scheme for the program you would want to read it in with, this
could be reduced to 18 digits of mantissa each, I believe. Representing
it in hex can be more compact and precise.

If the data is numeric and one or two dimensional, there are matlab
routines that will format the ASCII such that the resulting ascii can be
read by matlab to produce a matrix of the same size with the elements in
the same order. Extending that to 3 dimensions is not so bad. Going to 4
or more dimensions gets messy to represent as ASCII in a form that would
be read back in to form the original matrix.

Perhaps you could tell us a bit more about the data?

Tom Moriarty

unread,
Dec 4, 2010, 3:25:04 PM12/4/10
to
Hi Walter,
Thanks for your comments.

I believe that the data is a 2D array, approximately 200 X 350 of real numbers. I do not known the precision. There is probably some header text for each of the 342 columns.

Tom

Walter Roberson <robe...@hushmail.com> wrote in message <hYgKo.3298$%83....@newsfe16.iad>...

Jan Simon

unread,
Dec 4, 2010, 4:46:04 PM12/4/10
to
Dear Tom,

> I am not a Matlab user, but I have a Matlab data file (.MAT file) from the online supplemental information of a Proceedings of the National Academy of Sciences (PNAS)article. The file is about half a megabyte.

Which article?
Assuming that the author agrees, a conversion should be legal. So if you tell where to find the data, someone could convert it for you.

I personnally prefer the article "High income improves evaluation of life but not emotional well-being ". Perhaps I'm applying as a volunteer for some deeper studies.

Kind regards, Jan

Tom Moriarty

unread,
Dec 4, 2010, 7:52:04 PM12/4/10
to
Hi Jan,
The article is "Global Sea-Level Linked to Global Temperature" by Vermeer and Rahmstorf in the Proceedings of the Natonal Academy of Sciences. Here is a link to the article...
http://www.pnas.org/content/early/2009/12/04/0907765106.full.pdf

The file that I am trying to translate is in the supplementary material. The supplementary material is in the form of a zipped file that is the target of the folllowing link...
http://www.pnas.org/content/106/51/21527/suppl/DCSupplemental

The zipped file contains about a dozen matlab files. The one I am interested in is called "magicc_scenarios.mat"

The work "magicc" in the filename is an acronym for "Model for the Assessment of Greenhouse gas Induced Climate Change"

I could also simply email the "magicc_scenarios.mat" file, which I have already unzipped.

Thanks for any help you can provide.

Tom

"Jan Simon" <matlab.T...@nMINUSsimon.de> wrote in message <idecqs$aen$1...@fred.mathworks.com>...

0 new messages