How to Export Data to Matlab

Matlab is a very useful tool for post processing results obtained from OnScale. OnScale is able to export any time history or data array to a Matlab File with only a few lines of code.

Exporting Time Histories

When setting up outputs from a model, the form subcommand is used to export to Matlab. The following example exports 3 time histories to h1_data.mat.

      form matlab h1                     /* Write Time Histories to Matlab file (.mat)
      histname electrode vq top1         /* Time History 1 & 2
      hist xdsp $i1 $i1 1 $j3 $j3 1      /* Time History 3
      hist ydsp $i1 $i1 1 $j3 $j3 1      /* Time History 4

The Matlab file is formatted so that the time history number corresponds to which column that data is in. So for this example Time History 1 (voltage on top electrode) would be in column 1 of h1_data.mat.


Exporting Data Arrays

The same form subcommand is used to export data arrays to Matlab. However, an additional command is required. The following example exports two data arrays to d1_data.mat.

       file out filename.mat             /* Assign Matlab file as Output file (.mat)
       form out matlab d1                /* Write Data Outputs to assigned file 
       out modl                          /* Output Data 1
       out pres                          /* Output Data 2