Asked • 06/03/19

Create a python script to simulate a Matlab file and store results?

I have recently started working as a student assistant and I have to write a script in Pycharm (python) which is something new for me. My task is to write a python script which takes a Matlab file (.m file) from the server, execute it and store the results of that file in a different folder. I have created a function which returns the path of the matlab file from the server which I would like to simulate as shown below. def get_next_job() -> Path: host = '127.0.0.1' port = 2000 with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s: s.connect((host, port)) s.sendall(json.dumps({"task_name": "next_simulation_file", "host_name": socket.gethostname()}).encode()) received = s.recv(1024) m = received.decode() message = json.loads(m) return Path(message["next_simulation_file"]) Now, my question is how do I initialize matlab from python to simulate this file and store the results somewhere. I would really appreciate the help.

1 Expert Answer

By:

Mashetti A. answered • 03/23/25

Tutor
New to Wyzant

Expert Coding Tutor

Still looking for help? Get the right answer, fast.

Ask a question for free

Get a free answer to a quick problem.
Most questions answered within 4 hours.

OR

Find an Online Tutor Now

Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.