Reading from dump or pickle file, and other files

82 views (last 30 days)
Hi
i will start with my problem. i am working with a friend on a project. he gets dump files from a sensor and he extracts relevant data from the file to a pickle file.
i am working on an app with the matlab app designer that will get the data and do something with it.
our problem is in the interface between us. i admit i don't know what a dump file is and i didn't find how to work with matlab on those files, and when i looked for working with pickle files on matlab, all the answers talked about importing python libraries which is something i am trying to avoid.
so at this point he creates a pickle file which has a 3D matrix, and some other data... and we want to transfer that 3D matrix to my matlab app.
what i found so far is:
  1. as i mentioned, importing python libraries to matlab
  2. reshape the 3D matrix to 2D in python, then save it to a txt or excel file and then i read it with matlab and shape it back to 3D
So what i will please like to know is:
  1. is there a good and simple way to read pickle files in matlab?
  2. do you know any other file format that we could use to save that 3D matrix?
  3. if you know any other way to accomplish our goal it will be great!
thank you very much in advance
  1 Comment
Rik
Rik on 17 Aug 2020
The easiest way seems to be to avoid the pickle format in the first place. If you write your data as text, you can trivially read it with Matlab. Do you need to transfer exact floating point values or would a decimal representation be fine?

Sign in to comment.

Answers (1)

Juhi Singh
Juhi Singh on 20 Aug 2020
I understand that you want to have an interface between a pickle file and your MATLAB code. The easiest way to do that would be to convert the pickle file to 'mat' file.
You can do that in python with a few lines of code, as demonstrates in the link attached below:
I hope this answers your query.

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!