Skip to main content
Logo image

Exercises πŸ€”πŸ’­ Conceptual Questions

1.

(a) Running a Script.

When you run a MATLAB script, MATLAB executes commands:
  • in a random order based on variable names
  • from top to bottom in the order they appear
  • from bottom to top
  • only on lines that end with semicolons

(b) Workspace Connection.

    A script runs in its own private workspace, separate from the Command Window.
  • True.

  • Scripts share the base workspace with the Command Window, so variables can persist between runs unless you clear them.
  • False.

  • Scripts share the base workspace with the Command Window, so variables can persist between runs unless you clear them.

(c) Semicolons.

    Ending a line with a semicolon prevents that line’s result from automatically printing in the Command Window.
  • True.

  • Semicolons prevent intermediate computations from cluttering the output, making the final results easier to read.
  • False.

  • Semicolons prevent intermediate computations from cluttering the output, making the final results easier to read.

(d) Finding a Script.

If MATLAB says it cannot find your script, the most likely issue is that:
  • The script is not in the Current Folder
  • You forgot to use clc at the top
  • You used fprintf instead of display
  • Your script contains comments

(e) Match the Commands.

(f)