0

I want to save mxArray to an Octave .mat file.

I created a mex function with c++ in Octave that reads binary files and populate the data to an mxArray. I would like to visualize these data with Octave. I would like to save the data in an Octave format or .mat format. with Matlab, there are matOpen() to open a file, matClose() to close the file, and matPutVariable() to write the data to the file. what are the equivalent functions in Octave the these Matlab functions?

shizhen
  • 12,251
  • 9
  • 52
  • 88
  • This one might still be relevant even though it's old: https://stackoverflow.com/questions/9915658/how-do-you-open-mat-files-in-octave – Shawn Jul 09 '19 at 03:14
  • Try calling Octave to have it execute the `save` function. In MATLAB you’d use `mxCallMatlab`, not sure what the Octave equivalent is. – Cris Luengo Jul 09 '19 at 13:30
  • Just found `mexCallMatlab` https://octave.org/doc/interpreter/Calling-Other-Functions-in-Mex_002dFiles.html#Calling-Other-Functions-in-Mex_002dFiles – Arthur Jul 18 '19 at 07:04

1 Answers1

0

Edit :

As proposed in the comments of this (edited) answer : https://github.com/tbeu/matio is designed for that purpose. In an edit proposition the OP said :

this solved the issue. matio seems not optimized as Matlab library though.

Arthur
  • 508
  • 2
  • 14
  • Missed the mex file part.. https://github.com/tbeu/matio seems to be designed for that purpose. – Arthur Jul 09 '19 at 12:50
  • I used matio and compared it to Matlab library. Using the same input file. Matlab mex library produced 406kb output file. Matio produced 2Mb. I might be doing something wrong. – midnight_rambler Jul 17 '19 at 23:49
  • Have you figured out a way to answer the question in this post ? If yes you should post or accept an answer in order to help the next persons that will encounter the same problem as you. For your new question it is better to ask a new question as an independent post. – Arthur Jul 18 '19 at 06:59