Effacer les filtres
Effacer les filtres

Making a section in Python like Matlab

286 vues (au cours des 30 derniers jours)
uzzi
uzzi le 9 Juin 2023
Commenté : Al Danial le 14 Juin 2023
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.

Réponse acceptée

Al Danial
Al Danial le 10 Juin 2023
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 commentaires
uzzi
uzzi le 13 Juin 2023
what about for Pycharm. It doesn't work for Pycharm.
Al Danial
Al Danial le 14 Juin 2023
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.

Connectez-vous pour commenter.

Plus de réponses (1)

Govind KM
Govind KM le 9 Juin 2023
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.

Catégories

En savoir plus sur Call Python from MATLAB dans Help Center et File Exchange

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by