Skip to content

CreateMatrix

  CreateMatrix is presently unused

  CreateMatrix creates a new variable in a MAT-file (v6)

  Example:
  CreateMatrix(filename, var)
  CreateMatrix(filename, var, varsz)

  FILENAME is the name of the target MAT-file, which will be created if it
  does not already exist.

  VAR is the variable to create. It may be any standard MATLAB class and 
  may be complex. It may not be a cell, structure or object. The contents
  of VAR will be written to the target MAT-file. VAR must be the 
  first elements of the final variable - correctly ordered in memory.
  The variable in the file will then be padded to the required
  number of elements to match VARSZ. (Note: with complex data, the padding
  is not guaranteed to be zero-padding - some pad elements may be set to
  eps(class(var)). 
  Note that a variable with the same name as VAR may not already be present
  if FILENAME already exists.

  VARSZ is the target size of VAR

  Use:
  Suppose we wish to write 180 frames of a video to a MAT file. Each frame
  is a 100x100x3 RGB image (total of 43200000 bytes for the video).
  Then using AVIREAD to load each frame in turn:
  f=aviread('myvideo.avi',1); % Read frame 1
  CreateMatrix('mymatfile.mat',f,[1000 1000 3 180]);
  for n=2:180
  f=aviread('myvideo.avi',n);
  SavePartMatrix('mymatfile.mat',f);
  end

 __________________________________________________________________________

  This program is distributed without any warranty,
  without even the implied warranty of fitness for a particular purpose.
 __________________________________________________________________________

  Author: Malcolm Lidierth 11/06
  Copyright © The Author & King's College London 2006
 __________________________________________________________________________