Reading from dump or pickle file, and other files

65 次查看(过去 30 天)
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 个评论
Rik
Rik 2020-8-17
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?

请先登录,再进行评论。

回答(1 个)

Juhi Singh
Juhi Singh 2020-8-20
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.

类别

Help CenterFile Exchange 中查找有关 Call Python from MATLAB 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by