Making a section in Python like Matlab

조회 수: 341 (최근 30일)
uzzi
uzzi 2023년 6월 9일
댓글: Al Danial 2023년 6월 14일
Hello, I am a Matlab user and these days, I am working with Python. I don't know in which community that I should ask questions relating to this.
My questions is in Matlab, in a file, we can sectionalize by using '%%' and run each section separately. How do I sectionalize in Python and run the sections seperately?
Can someone answer this question. It will be a big help.

채택된 답변

Al Danial
Al Danial 2023년 6월 10일
Python IDEs such as Spyder also support code cels. The delimiter there is #%%. As in the matlab IDE, in Spyder you can run all the code in a Python cell before moving to the next one. Here's what code cells look like in Spyder:
  댓글 수: 2
uzzi
uzzi 2023년 6월 13일
what about for Pycharm. It doesn't work for Pycharm.
Al Danial
Al Danial 2023년 6월 14일
In PyCharm the delimiter looks to be ##. Isn't clear to me if that's in all PyCharm versions or if you need the Pro version.

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

추가 답변 (1개)

Govind KM
Govind KM 2023년 6월 9일
I don't think there is any equivalent functionality in Python. Maybe you can make a function for each section and run the required parts by just running the current line of code.

카테고리

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