Re: Using .sav files outside of IDL [message #54275] |
Tue, 29 May 2007 17:48 |
Rick Towler
Messages: 821 Registered: August 1998
|
Senior Member |
|
|
You'll most likely have to give up on having the structure definition
stored in this file. (I think) the best you will be able to do is stuff
the data into a file in a known order then read it out and construct
your structure on the other side. I recommend XDR because it is so
simple (although I haven't created XDR files in IDL and read them in
MATLAB so who knows what could crop up). There isn't built in support
for MATLAB but libraries are available. Here's one:
http://crppwww.epfl.ch/~moret/matlab/local.html
and there are others. Java based XDR libraries would be trivial to use too.
As someone mentioned, XML is an option is your structures aren't too
"heavy". There are a number of XML parsers on the MATLAB central file
exchange that will read an XML file into a structure but you would still
need to write a function in IDL that would write the XML file to their
specific formats. Probably easier to go the XDR route.
-Rick
skcllus@gmail.com wrote:
> Hello,
>
> I have two structures saved in an IDL .sav file. Do you guys know how
> I can import this data to MATLAB. When I try, it says that .sav file
> is a proprietary format. I have a few IDL procedures that play with
> the data, and I'd like to port them to MATLAB. If it's not possible,
> can you suggest how I should go about saving these structures to a
> format that MATLAB would be able to read (preferably I would like the
> form of the structures preserved so that I won't have to think up new
> code/logic). Should I write to a file? If so, what format should I
> use?
>
> So, how do I save my structure to a non-proprietary format?
>
> Thank you
>
|
|
|
Re: Using .sav files outside of IDL [message #54278 is a reply to message #54275] |
Tue, 29 May 2007 14:19  |
Paul Van Delst[1]
Messages: 1157 Registered: April 2002
|
Senior Member |
|
|
skcllus@gmail.com wrote:
> Hello,
>
> I have two structures saved in an IDL .sav file. Do you guys know how
> I can import this data to MATLAB. When I try, it says that .sav file
> is a proprietary format. I have a few IDL procedures that play with
> the data, and I'd like to port them to MATLAB. If it's not possible,
> can you suggest how I should go about saving these structures to a
> format that MATLAB would be able to read (preferably I would like the
> form of the structures preserved so that I won't have to think up new
> code/logic). Should I write to a file? If so, what format should I
> use?
I use netCDF for transporting data (or my own home-grown "binary" format). For your case I
would consider netCDF since both IDL and matlab have netCDF APIs so all you have to write
is the IDL wrapper code that writes your IDL structure to netCDF, and matlab code that
reads the netCDF file into a matlab structure.
Alternatively, you could see if IDL save files written in XDR format are readable in matlab.
cheers,
paulv
--
Paul van Delst Ride lots.
CIMSS @ NOAA/NCEP/EMC Eddy Merckx
|
|
|
Re: Using .sav files outside of IDL [message #54279 is a reply to message #54278] |
Tue, 29 May 2007 14:01  |
Vince Hradil
Messages: 574 Registered: December 1999
|
Senior Member |
|
|
On May 29, 2:00 pm, skcl...@gmail.com wrote:
> Hello,
>
> I have two structures saved in an IDL .sav file. Do you guys know how
> I can import this data to MATLAB. When I try, it says that .sav file
> is a proprietary format. I have a few IDL procedures that play with
> the data, and I'd like to port them to MATLAB. If it's not possible,
> can you suggest how I should go about saving these structures to a
> format that MATLAB would be able to read (preferably I would like the
> form of the structures preserved so that I won't have to think up new
> code/logic). Should I write to a file? If so, what format should I
> use?
>
> So, how do I save my structure to a non-proprietary format?
>
> Thank you
I don't do Matlab, but isn't there a "struct". Can you just define
one and read in the data? Or maybe use xml and parse it in matlab...
Just off the top of my head.
|
|
|