Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Julia: How to clear console

I am using Julia Studio and would like to know the command for clearing the console of text and memory like imports or variables? Something like matlabs "clc" and "clear" commands.

like image 842
Alex_ Avatar asked Oct 24 '14 13:10

Alex_


People also ask

How do I clear the console screen?

You can use Ctrl+L keyboard shortcut in Linux to clear the screen. It works in most terminal emulators. If you use Ctrl+L and clear command in GNOME terminal (default in Ubuntu), you'll notice the difference between their impact.

How do you clear all in Julia?

Ctrl+J, Ctrl+C will clear the Console but not the Workspace: the variables and functions created are not cleared. You can clear the Workspace from the Console by pressing Ctrl+D to end Julia and Enter to start it again.

Which code is used to clear the Consol?

In the above example, we have specified the Windows operating system and the command that is used to clear the console is cls. We can also use the following code in the above program: public final static void clearConsole()

How do I clear my CPP console?

To clear the screen in Visual C++, utilize the code: system("CLS"); The standard library header file <stdlib. h> is needed.


2 Answers

To clear the console, you can go into the shell and run clear (or cls) from there:

julia> ;
shell> clear
like image 110
Jake Ireland Avatar answered Oct 20 '22 14:10

Jake Ireland


As mentioned workspace() provides a fresh Main. One can clear variables (and the screen) with the following:


function clear()
    Base.run(`clear`)
    for var in names(Main)
        try
            eval(parse("$var=0"))
        catch e
        end
    end
    gc()
end

Variable definitions are permanent but can be nulled. To free types and the like wrap them in modules. For more info see the first two questions here.

like image 33
Qni Avatar answered Oct 20 '22 16:10

Qni