Why is it helpful to use regions/sections while writing a script in matlab?
10 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Ottavia Rossini
el 23 de Jun. de 2017
Comentada: Adam
el 23 de Jun. de 2017
I was trying to make my script tidy and found out that it's possible to insert regions and sections in matlab scripts/functions. How are they correctly used? Why are they so helpful?
Thanks for your help :)
1 comentario
Adam
el 23 de Jun. de 2017
I'm not familiar with what a 'region' is, but I pretty much never use sections. Just personal preference, but to me they confuse the reading of code rather than help it. I don't write scripts often though except for quick initial exploration of ideas and having sections in a function seems odd to me.
Respuesta aceptada
Stephen23
el 23 de Jun. de 2017
Editada: Stephen23
el 23 de Jun. de 2017
Three good reasons:
- Code folding: https://www.mathworks.com/help/matlab/matlab_prog/improve-code-readability.html
- Run sections: https://www.mathworks.com/help/matlab/matlab_prog/run-sections-of-programs.html
- Because using standard tools (default indentation, code sections, etc), makes code clearer and easier to understand. Code that is clearer and easier to understand is less buggy and easier to fix.
0 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Logical en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!