How can I run a jupyter notebook script from matlab?

조회 수: 100 (최근 30일)
Rachel Dawn
Rachel Dawn 2020년 11월 12일
답변: Sourabh Kondapaka 2020년 11월 19일
I already tried running matlab from jupyter using Oct2Py but it didn't work (error after error).
So, I'm wondering if I can use matlab to run a jupyter notebook script (this would be much simpler because most of my code is in matlab- only a small part of it (the machine learning part) is in jupyter notebook.
Thanks.
  댓글 수: 3
Rachel Dawn
Rachel Dawn 2020년 11월 12일
Say the jupyter file is called "kmeans.ipynb" How would I "navigate to the file and start it?
I'm a beginner at this coding stuff sorry
Sourabh Kondapaka
Sourabh Kondapaka 2020년 11월 16일
Do you mean to run all cells of the jupyter notebook from matlab ?

댓글을 달려면 로그인하십시오.

답변 (1개)

Sourabh Kondapaka
Sourabh Kondapaka 2020년 11월 19일
You can convert the kmeans.ipynb file to a python script by either of the followign ways:
  1. Open kmeans.ipynb -> Click on File -> Download as -> Python (.py) . The python script can be found in your downloads folder. Now copy the python script file to the same directory as your matlab script and then follow Lukas Hagmeyer's suggestion : [status,cmdout] = system('python kmeans.py');
  2. The other way to convert .ipynb to .py file is to use nbconvert python package. Fore more info you can check their documentation

카테고리

Help CenterFile Exchange에서 Integration with Online Platforms에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by