Archived OpenModelica forums. Posting is disabled.

Alternative forums include GitHub discussions or StackOverflow (make sure to read the Stack Overflow rules; you need to have well-formed questions)


Forgot password? | Forgot username? | Register

Browsing / accessing results in Matlab?

Browsing / accessing results in Matlab?

Hi all,

I wonder if there is some matlab code to browse the results (saved as mat file) in matlab? Where can I find information on how to extract simulation results from mat files?

Thanks
Alex

Re: Browsing / accessing results in Matlab?

Using the MATLAB clone GNU Octave:

Code:


octave:1> load A_res.mat
octave:2> who
Variables in the current scope:

Aclass       dataInfo     data_2       name
ans          data_1       description

Aclass describes the format (if it is transposed matrices or not)

Code:

octave:3> Aclass

Aclass =

Atrajectory
1.1       
           
binTrans

Code:

octave:6> dataInfo

dataInfo =

   2   2   2
   1   2  -2
   0   0   0
  -1  -1  -1

The dataInfo is Nx4. Each variable has 4 fields.
1) Part of matrix data_N where N is the value of the variable
2) Index in this matrix (negative indices means it is a negative alias of that index)
3) and 4) are unused by OpenModelica. Handles interpolation and stuff in Dymola I believe

Code:

octave:9> name'

ans =

time
x
y

In OpenModelica we transpose this matrix for some reason current/smile The order of the names (and description) matrices are the same as dataInfo.

So to get all y-values:

Code:

-data_2(2,:)

There are 0 guests and 0 other users also viewing this topic
You are here: