f



load5 - A solution to reading Matlab 7 files in Matlab 6.5

After lots of hunting around with old friends, I was able to locate
Windows libraries of Matlab 6.5.  In addition, I have put a couple
"extras" into the load5 command.

As soon as it appears in the file exchange (and i notice it), i will
update the file to a .zip file which will contain both Windows and
Linux versions of load5.  Note that if you use this MEX file with R14
in linux, you will need to copy the libz.so.1.2.2 to either the matlab
directory and modify the symbolic links libz.so and libz.so.1, or put
it in your path and make sure the LD_LIBRARY_PATH has your directory
preceding matlab's.  I didn't have any problems on Windows R14 picking
up the libz.dll, so I don't think it's necessary.  The help for load5
is below.  You can run load5 --help or help load5 (if you have the
load5.m file in your path).  I was able to put a couple features I've
wanted but couldn't get load to do (not to say it can't).  Sometimes
files I want to load have variables with the same name, rather than
renaming one in the workspace, I can change the name as I load it using
'='.  Also, pre/appending strings to variables loaded from the MAT file
(as in the example below).

Future plans (not very high priority) would be to add the ability of
loading only specific fields of a structure, specified elements of a
cell array, and eventually the ultimate goal is hyperslabs (an HDF5
term for partial I/O or reading sections of a dataset).

>> load5 --help

Usage: load5([OPTIONS],filename,var1,var2,...)
       load5 [OPTIONS] filename var1 var2 ...
       load5 [OPTIONS] filename var1as=var1 var2as=var2

  Loads a Matlab MAT version 5 compatible matlab file

  OPTIONS
    --help          - This output
    --version       - version information
    --prefix PREFIX - prepends PREFIX to variables loaded from MAT file
                      except variable names explicitly set using '='
    --suffix SUFFIX - appends SUFFIX to variables loaded from MAT file
                      except variable names explicitly set using '='

  INPUT:
    filename - MAT filename with .mat extension
  OPTIONAL INPUT:
    var1     - Name of variable to load
    :
    var#     - Name of variable to load

  EXAMPLES:
    >> load5 --prefix pre_ --suffix _suf dem dLat dLon TerrainHeight=th
    >> whos
      Name               Size                   Bytes  Class

      pre_dLat_suf       1x1                        8  double array
      pre_dLon_suf       1x1                        8  double array
      th              1440x1441               2075040  uint8 array

    Grand total is 2075042 elements using 2075056 bytes

    >>


    >> load5('--prefix','pre_','--suffix','_suf','dem.mat');
    >> whos
      Name                            Size                   Bytes
Class

      pre_SouthmostLatitude_suf       1x1                        8
double array
      pre_TerrainHeight_suf        1440x1441               2075040
uint8 array
      pre_WestmostLongitude_suf       1x1                        8
double array
      pre_dLat_suf                    1x1                        8
double array
      pre_dLon_suf                    1x1                        8
double array

    Grand total is 2075044 elements using 2075072 bytes
    
    >>
>>

0
cchgroupmail (819)
5/27/2005 12:07:08 PM
comp.soft-sys.matlab 211266 articles. 15 followers. lunamoonmoon (258) is leader. Post Follow

0 Replies
1197 Views

Similar Articles

[PageSpeed] 48

Reply: