โ† All MATLAB Flashcard Decks

Environment and Syntax Flashcards

7 cards from real MATLAB practice questions. Tap to flip, then mark Knew It or Still Learning โ€” missed cards come back until you master them.

Read the first 7 Environment and Syntax flashcards as text
  1. What does the `path` command do in MATLAB?

    Answer: Displays or modifies the MATLAB search path

    The `path` command displays the current MATLAB search path and can be used to add or remove directories from it.

  2. In MATLAB, what is the difference between a script and a function file?

    Answer: Functions have their own workspace; scripts share the base workspace

    Functions operate in their own local workspace and can accept inputs/outputs, while scripts run in the base workspace.

  3. What does `format long` do in MATLAB?

    Answer: Displays numbers with 15 significant digits

    `format long` switches numeric display to 15 significant digits instead of the default 5 (`format short`).

  4. How do you add a comment to a MATLAB script?

    Answer: Use % before the comment text

    The percent sign `%` begins a single-line comment in MATLAB; everything after it on that line is ignored.

  5. What is the output of `class(uint8(5))` in MATLAB?

    Answer: uint8

    `class()` returns the data type of a variable as a string, so `class(uint8(5))` returns `'uint8'`.

  6. Which MATLAB function opens the built-in documentation browser for a specific function?

    Answer: doc

    `doc functionName` opens the full HTML documentation page in the MATLAB Help browser, while `help` shows text-only docs in the Command Window.

  7. What is the MATLAB operator for element-wise multiplication of two arrays?

    Answer: .*

    The `.*` operator multiplies arrays element by element, whereas `*` performs matrix multiplication.