TestingDocs.com
Software Testing website
  • Automation
    • Selenium
    • JBehave Framework
  • Tutorials
    • MySQL Tutorials
    • Testlink
    • Maven
    • Git
  • IDEs
    • IntelliJ IDEA
    • Eclipse
  • Flowcharts
    • Flowgorithm
    • Raptor
  • About

Octave

Octave clear command

Overview

In this tutorial, we will learn about the Octave clear command. The clear command deletes the variables that match the pattern to free memory for the current Octave session.

We can use the command at the Command Window prompt or in the Octave script.

Syntax

To clear all the variables in the Octave session.

>> clear

To clear the variables that match the pattern in the Octave session. The PATTERN may contain the following special characters.

>> clear [options] PATTERN

Some of the characters and the descriptions are as follows:

Character
Description
 

‘?’

Match any single character
 

‘*’

Match zero or more characters
‘[ LIST ]’

 

Match the list of characters specified by the LIST

 

Example

# clear command

The simple clear command clears all the variables in the Octave session.

In this example, we will define three variables at the command window prompt.

>> website = “TestingDocs.com”;
>> area = 32.50;
>> radius = sqrt(area/pi);
>> who
Variables visible from the current scope:

area radius website

Check the values by typing the name of the variable at the command prompt

>> website
website = TestingDocs.com
>> area
area = 32.500
>> radius
radius = 3.2164
>>

Issue the clear command.

>> clear

Check with the who or whos command. All the variables defined will be cleared.

Octave clear all local variables

# clear command with pattern

Let’s clear the command with a character matching pattern. We will define two variables foo and bar. We will clear the variable bar with the clear command.

>> foo=’foo’;
>> bar=’bar’;
>> who
Variables visible from the current scope:

bar foo

>> clear b*r
>> who
Variables visible from the current scope:

foo

 

Octave clear command

Octave has a special clc() command to clear the command window terminal screen. The clc command is used to clear the command window and takes the cursor to the top left corner. The clc command will not delete the variables.

—

Octave Tutorials

Octave Tutorial on this website can be found at:
https://www.testingdocs.com/octave-tutorial/

More information on Octave can be found on the official website:
https://www.gnu.org/software/octave/index

Related Posts

Octave Package List

Octave /

Install Octave Packages on Linux

Octave /

Octave User defined Function Example

octave command line linux

Octave /

Octave Command line on Ubuntu

Hello World in Octave

Octave /

Hello World in Octave

Octave /

Octave plot example of function y=x^2

‹ Octave who command› Inverse Trigonometric Functions in Octave

Recent Posts

  • Update draw.io on Windows
  • Install RAPTOR Avalonia on CentOS
  • Download RAPTOR Avalonia Edition on Windows
  • npm doctor command
  • Build & Run CLion Project
  • Create New CLion C Project on Windows
  • Configure CLion Toolchains on Windows
  • Launch CLion IDE on Windows
  • Activate CLion IDE
  • CLion IDE for C/C++ Development

Back to Top

Links

  • Contact
  • Privacy Policy
  • Cookie Policy

www.TestingDocs.com