How to Export Data to Matlab

Follow

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 four time histories to h1_data.mat.

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

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.

h1_data.PNG

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.

data
       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 
       end
0 out of 0 found this helpful

Comments

0 comments

Please sign in to leave a comment.