No BSD License  

Highlights from
Arbitrary files & MATLAB variables <-> data stream vector converter

from Arbitrary files & MATLAB variables <-> data stream vector converter by Hoi Wong
Encode any MATLAB data types into a numeric array, and vice versa

var2stream(MATLABvariable, tempFolderPath)
function dataStream = var2stream(MATLABvariable, tempFolderPath)

% This program converts a MATLAB variable into data stream that
% can be decoded by stream2var().
%
% Application: Transfer MATLAB variables of ANY data type between COM
%              server and clients.
%
% Implication: You can transfer data around just by converting them into
%              a stream of numbers. 
%
% Future work: Add compression feature to facilliate fast data transfer
%
% Dependency:  file2stream.m
%
% Author:      Hoi Wong (wonghoi.ee@gmail.com)
% Date:        01/24/2008

    if( nargin == 1 )
        tempFileName = [tempname '.mat'];
    elseif( nargin == 2)
        tempFileName = [tempname(tempFolderPath), '.mat'];
    end   
    
    % Generate the transitional .mat file
    save(tempFileName, 'MATLABvariable');
    
    % Read the .mat file
    dataStream = file2stream(tempFileName);
    
    % Remote the temporary .mat file
    delete(tempFileName);

Contact us at files@mathworks.com