{"id":19129925,"url":"https://github.com/mathworks/matlab-live-task-for-python","last_synced_at":"2025-07-10T10:41:29.633Z","repository":{"id":45672248,"uuid":"488523226","full_name":"mathworks/MATLAB-Live-Task-for-Python","owner":"mathworks","description":"The MATLAB® Live Task for Python® enables you to write and execute Python code directly inside of a MATLAB Live Script.","archived":false,"fork":false,"pushed_at":"2024-03-26T09:37:02.000Z","size":255,"stargazers_count":56,"open_issues_count":3,"forks_count":13,"subscribers_count":9,"default_branch":"master","last_synced_at":"2025-04-19T12:42:52.315Z","etag":null,"topics":["matlab","matlab-python","python"],"latest_commit_sha":null,"homepage":"","language":"MATLAB","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-2-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mathworks.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2022-05-04T09:16:20.000Z","updated_at":"2025-03-26T03:44:07.000Z","dependencies_parsed_at":"2023-01-18T18:02:16.725Z","dependency_job_id":"95262647-7724-451f-9d57-674382b8a3a5","html_url":"https://github.com/mathworks/MATLAB-Live-Task-for-Python","commit_stats":{"total_commits":5,"total_committers":3,"mean_commits":"1.6666666666666667","dds":0.4,"last_synced_commit":"bf9a9ca9e312cb1da8835975e92e017e64bd74f8"},"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mathworks%2FMATLAB-Live-Task-for-Python","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mathworks%2FMATLAB-Live-Task-for-Python/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mathworks%2FMATLAB-Live-Task-for-Python/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mathworks%2FMATLAB-Live-Task-for-Python/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mathworks","download_url":"https://codeload.github.com/mathworks/MATLAB-Live-Task-for-Python/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252600751,"owners_count":21774649,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["matlab","matlab-python","python"],"created_at":"2024-11-09T06:09:01.326Z","updated_at":"2025-05-06T00:37:53.797Z","avatar_url":"https://github.com/mathworks.png","language":"MATLAB","funding_links":[],"categories":[],"sub_categories":[],"readme":"# MATLAB Live Task for Python\n\n[![View MATLAB Live Task for Python on File Exchange](https://www.mathworks.com/matlabcentral/images/matlab-file-exchange.svg)](https://www.mathworks.com/matlabcentral/fileexchange/111240-matlab-live-task-for-python)\n\n_If using MATLAB R2024a or later, use the [Run Python Python Live Editor Live Task](https://www.mathworks.com/help/matlab/ref/runpythoncode.html) instead._\n\nThe MATLAB® Live Task for Python® enables you to write and execute Python code directly inside of a MATLAB Live Script. Since R2022a, MATLAB provides a way to develop your own [custom live task](https://www.mathworks.com/help/matlab/creating_guis/live-task-development-overview.html).\n\n---\n\n## Requirements\n### Required MathWorks Products\n* MATLAB R2022a or later\n\n### Required 3rd Party Products\n* Python (supported Python versions by MATLAB release can be found [here](https://www.mathworks.com/support/requirements/python-compatibility.html))\n\n---\n\n## Install\nRun the `install` script to add the required paths to your MATLAB environment and configure the MATLAB Live Task for Python. Click 'Ok' when promtped with the following UI to configure the Live Editor task metadata:\n\n![img/pythonTaskInstall.png](img/pythonTaskInstall.png)\n\n---\n\n## Getting Started\nTo insert the live task in your live script:\n\n1. Go to the Live Editor tab in the Editor Toolstrip and select Task: \n\n    ![img/pythonTask1.png](img/pythonTask1.png)\n\n2. Then, choose the live task under the MY TASKS category:\n\n    ![img/pythonTask2.png](img/pythonTask2.png)\n\nAlternatively you may simply type `python` and the autocomplete feature will suggest the appropriate task:\n\n![img/pythonTask3.png](img/pythonTask3.png)\n\nThis is what the MATLAB Live Task for Python looks like:\n\n![img/pythonTask4.png](img/pythonTask4.png)\n\nFirst, create a variable in the MATLAB workspace: \n```\n\u003e\u003e T = 'We at MathWorks believe in the importance of engineers and scientists. They increase human knowledge and profoundly improve our standard of living.';\n```\n\nThe Python input and output variables can be mapped with variables in the MATLAB workspace: \n\n![img/pythonTask5.png](img/pythonTask5.png)\n\nYou can choose to write either Python statements or a Python script file: \n\n![img/pythonTask6.png](img/pythonTask6.png)\n\nand retrieve the required variables to be used back in MATLAB:\n\n![img/pythonTask7.png](img/pythonTask7.png)\n\nThe equivalent MATLAB code to run either the Python statements (using [`pyrun`](https://www.mathworks.com/help/matlab/ref/pyrun.html)) or a Python script (using [`pyrunfile`](https://www.mathworks.com/help/matlab/ref/pyrunfile.html)) is generated and run automatically by default like any live task:\n\n![img/pythonTask8.png](img/pythonTask8.png)\n\n```\n\u003e\u003e wrapped = string(wrapped)'\n\nwrapped = \n\n  6×1 string array\n\n    \"% We at MathWorks believe in\"\n    \"% the importance of engineers\"\n    \"% and scientists. They\"\n    \"% increase human knowledge and\"\n    \"% profoundly improve our\"\n    \"% standard of living.\"\n```\n\n---\n\n## Examples\n\nYou can find examples on how to use the MATLAB Live Task for Python in the `examples` folder within this repository.\n\n---\n\n## Support\n\nTechnical issues or enhancement requests can be submitted [here](https://github.com/mathworks/MATLAB-Live-Task-for-Python/issues).\n\n---\n\n## License\nThe license is available in the License file within this repository\n\nCopyright © 2022 MathWorks, Inc. All rights reserved.\n\n\"Python\" is a registered trademark of the Python Software Foundation.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmathworks%2Fmatlab-live-task-for-python","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmathworks%2Fmatlab-live-task-for-python","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmathworks%2Fmatlab-live-task-for-python/lists"}