Matmap Documentation
[documentation home]

Matlab to SCIRun


Currently the conversion from Matlab to SCIRun is limited to  SCIRun matrices. This document contains a short description on how to convert the data obtained at CVRTI to a SCIRun format.


Writing a SCIRun matrix file

The function scirunWriteMatrix will write a file in the SCIRun matrix format. Hence this can be used to import time series into SCIRun. The script converts both sparse and dense matrices in files that can be read be SCIRun. The function uses the following syntax:

>> M = rand(10,10);
>> scirunWriteMatrix('scirunmatrix.mat',M,'BIN');
This will generate a random 10 by 10 matrix and export its contents into a SCIRun matrix file.

Note, that both SCIRun and Matlab use the same filename extension (both are .mat). Both the ASCii ('ASC') as well as the binary ('BIN') format are supported by this function. The function does not use any of the internal SCIRun functions and hence will only work as long as the fileformats in SCIRun remain the same.


Converting .TSDF/.ACQ/.DATA data

The function above can of course be used to export data from .TSDF/.ACQ/.DATA files into SCIRun matrices. The following example demonstrates how to convert the data in a file called 'data.tsdf' into the SCIRun matrix 'data.mat':

>> index = ioReadTS('data.tsdf');
>> scirunWriteMatrix('data.mat',TS{index}.potvals,'BIN');
This is all that is needed fr the conversion process. Note, that only the actual data matrix is exported and the rest of the information is stripped away.


Reading a SCIRun matrix file

For reading SCIRun matrices the function scirunReadMatrix(), can be used. As SCIRun fileformats change with time, this function may not be up to date. Currently it has been tested and works with SCIRun 1.20. The function supports both binary and ASCii formats. However in case of the binary format, please leave the property manager empty, as the function does not support reading these properties and will fail reading the matrix. In ASCii format the function will skip over these properties and no problem is encountered. The function can be used as following:

>> M = scirunReadMatrix('scimatrix.mat');