Python Forum
How can I save Python dictionaries in Matlab?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How can I save Python dictionaries in Matlab?
#1
What is the simplest way to send complex data from Matlab to Python? I have a pre-written script in Python that uses dictionaries as the base data form and it would be difficult to change this. I know py.dict exists in Matlab but up to this point I've found no way to save the dictionary in Matlab and re-open it in Python. If all scripts were just written in Python, I could use a Pickle file to do this but, as far as I can tell, there is no equivalent in Matlab, and I'm dependent on a Matlab only toolbox to get the data. Is there a way to send more complex dataforms than an array from Matlab to Python?
Reply
#2
It depends on what the term complex data means?!
I didn't work with MatLab for a long time, but I think json format would be a good choice to transfer data between Python and MatLab (and vice versa). You can communicate with Python program via TCP/IP by sending json-encoded data. Python program will listen on a specific port and process sent data. As I said, I don't touch MatLab for a long time, may be some MatLab Toolbox already developed to interact with Python program in more convenient way.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  how to save to multiple locations during save cubangt 1 554 Oct-23-2023, 10:16 PM
Last Post: deanhystad
Photo Matlab to Python Sateesh 0 1,676 Nov-04-2020, 09:11 AM
Last Post: Sateesh
  From Matlab to Python erbab 1 2,015 Oct-27-2020, 02:16 PM
Last Post: jefsummers
  Arrays in MATLAB and PYTHON cokhuatlanyeuthuongconhetmuc 2 2,198 Jul-24-2020, 10:47 AM
Last Post: cokhuatlanyeuthuongconhetmuc
  Matlab to Python -- Parallel Computing zistambo 1 1,970 Jun-10-2020, 04:59 PM
Last Post: pyzyx3qwerty
  Python v MatLab for graphs and plots CynthiaMoore 4 3,037 Apr-22-2020, 02:13 PM
Last Post: CynthiaMoore
  python equivalent to MATLAB xcov chai0404 2 3,876 Apr-02-2020, 10:29 PM
Last Post: chai0404
  Python equivalent of Matlab code kwokmaster 1 3,452 Mar-25-2020, 10:14 PM
Last Post: j.crater
  MATLAB to Python conversion stokd 10 5,024 Jan-19-2020, 09:14 PM
Last Post: stokd
  Data Dictionaries in Python mrsenorchuck 16 7,345 Nov-25-2019, 09:29 PM
Last Post: mrsenorchuck

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020