Author: R. Soliday
If you have problems please email me at email@example.com
|Step 1: Linux|
|Download or build the SDDS Java Binary (JAR) file.|
|Step 1: Windows|
|Download the Java SDDS Binaries or build the the SDDS Java Binary (JAR) file.|
|Step 2: Linux|
|Edit /usr/local/matlab/toolbox/local/classpath.txt (your location may be different) and add a link to SDDS.jar.|
|Step 2: Windows|
|Edit C:\MATLAB6p1\toolbox\local\classpath.txt (your location may be different) and add a link to c:/Program Files/APS/Java SDDS/SDDS.jar|
|If your Matlab version is older than version 13 you will have to install the Java Runtime Environment version 1.3.1. The newer versions will not work with Matlab and the version that comes with Matlab is too old to work with the Java SDDS library. Once installed you will have to set the environment variable MATLAB_JAVA to the directory of the JRE.|
|Download and unpack the SDDS Matlab M-Files. These files can be used by Matlab if they are in the current working directory or if they are added to Matlab's path.|
|You can now load sdds files into a Matlab structure. The structure looks like:
sdds.filename sdds.ascii sdds.pages sdds.parameter_names sdds.array_names sdds.column_names sdds.description.contents .text sdds.parameter.[parameter name].type .units .symbol .format_string .description .data sdds.column.[column name].type .units .symbol .format_string .description .page[number] sdds.array.[array name].dimensions .type .units .symbol .format_string .group_name .description .size_page[number] .page[number] The commands for loading and saving SDDS files from Matlab are: sdds = sddsload('inputFile.sdds') % Load inputFile.sdds sddssave(sdds) % Save to sdds.filename sddssave(sdds, 'outputFile.sdds') % Save to outputFile.sdds Note: Not all fields are required to save an SDDS file.
|Answers to common questions|
The values for columns are returned asjava.lang.struct objects. How do I convert these into MATLAB vectors? Using the SDDSUtil.castArrayAsDouble command. Here is an example: import SDDS.java.SDDS.* sdds = sddsload('/tmp/junk') sdds.column.[column name].page1 = SDDSUtil.castArrayAsDouble(sdds.column.[column name].page1, SDDSUtil.identifyType(sdds.column.[column name].type)) I am getting the error message java.lang.OutOfMemoryError what do I do? When Matlab starts the java interpreter it starts it with a maximum Java memory heap size which is often too small. On Solaris all I have to do is start Matlab from a directory that contains a file called java.opts. This file has one line: -Xmx268435456 This tells matlab to start the java interpreter with 256 MBs as the maximum Java memory heap size. I think on Windows this file would go in the directory where the Matlab binary is.