octavesections

What is the purpose of "Sections" in Octave code?


Is there a purpose for "sections" in Octave code? They are defined in the Octave documentation, but through personal experience and this answer, there is no way to run a section as in Matlab (using "CTRL-Enter"). What is the purpose of a Section in Octave?


Solution

  • Sections in Octave relate to publishing and format control of script files, and have nothing to do with code execution. In the documentation page you linked, if you step 'up' from 11.11.2.3 Sections to 11.11.2 Publishing Markup to 11.11 Script Files, you'll see at the end of that section a few links to 11.11.1 Publish Octave Script Files where it describes how:

    The function publish provides a dynamic possibility to document your script file. Unlike static documentation, publish runs the script file, saves any figures and output while running the script, and presents them alongside static documentation in a desired output format.

    Sections, in this context, refers to ways to block off part of your script for markup, including sections of html, latex, and other formatting styles.