comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: IDL routine to read MATLAB MAT-files
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: IDL routine to read MATLAB MAT-files [message #75523] Tue, 22 March 2011 16:55 Go to previous message
Gordon Farquharson is currently offline  Gordon Farquharson
Messages: 48
Registered: December 2010
Member
On Mar 22, 4:09 pm, Gordon Farquharson <gordonfarquhar...@gmail.com>
wrote:

> I've written an IDL routine to read MATLAB MAT-files. I thought that
> this routine may be useful to others on this list, so I've made the
> code available at GitHub:

I've just realized that you'll need an a routine I wrote called
add_path_sep.pro. Here is the code. It should be platform independent,
but I've only tested it on a Linux machine. (Is there a better way to
do this in IDL?)

---

FUNCTION add_path_sep, dir, DEFAULT=default

compile_opt IDL2

sep_char = path_sep()

IF (n_elements(dir) NE 0) THEN BEGIN
_dir = dir
pos = strpos(_dir, sep_char, /REVERSE_SEARCH)
IF (pos NE (strlen(_dir)-1)) THEN _dir += sep_char
ENDIF ELSE BEGIN
IF (keyword_set(default)) && (n_elements(default) NE 0) && $
(size(default, /TYPE) EQ 7) THEN BEGIN
_dir = default
ENDIF ELSE BEGIN
_dir = ''
ENDELSE
ENDELSE

return, _dir

END

---

Also, the load_mat routine only works for MAT-files written on little-
endian machines.

Gordon
[Message index]
 
Read Message
Read Message
Previous Topic: IDL/ENVI User Group Meeting Call for Abstracts
Next Topic: Interpolate between two curves

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 19:19:13 PDT 2025

Total time taken to generate the page: 0.01169 seconds