# Julia REPL flow coming from Matlab

**URL:** <https://discourse.julialang.org/t/julia-repl-flow-coming-from-matlab/50499>\
**Category:** New to Julia\
**Created:** [November 20, 2020, 2:23pm UTC](https://discourse.julialang.org/t/julia-repl-flow-coming-from-matlab/50499 "2020-11-20T14:23:40Z")\
**Posts on this page:** 1\
**Showing post:** 5

<div class="post-metadata">

**Author:** ![lmiq](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/lmiq/32/18314_2.png) [@lmiq](https://discourse.julialang.org/u/lmiq)\
**Post date:** [November 20, 2020, 3:58pm UTC](https://discourse.julialang.org/t/julia-repl-flow-coming-from-matlab/50499/5 "2020-11-20T15:58:47Z")

</div>

As Elrod mentioned, there is no such thing as a “clear”, but you can redefine you variables at will:

```julia
data = [1, 2, 3]
f(data)
data = [2, 3, 4]
f(data)

```

Assuming that your data is constant, as you described initially, you could very directly just load a script repeatedly with the analysis and plotting/report functions, as you fiddle with the analysis functions, something as:

```julia
include("set_data.jl")
include("analyze.jl")
include("report.jl")
#--- change something in "analyze.jl"
include("analyze.jl")
include("report.jl")

```

where the `analyze.jl` and `report.jl` files include both the functions and the call to those functions using the data variables. I use that frequently for fast exploration of code.

When things get more complicated, you probably want to use `Revise` (or even before things get complicated). With `Revise` you can include your script once, and the changes will be tracked automatically. In that case, the call to the functions should be done at the REPL (not included in the scripts). Something like:

```julia
using Revise
include("set_data.jl")
includet("analyze.jl") # note the "t", for track
includet("report.jl") 

result = analyze(data)
report(result)

# Modifity the functions inside analyze.jl and report.jl
# new run will be automatically with the new versions:

result = analyze(data)
report(result)

```

Some people just use `Revise` by default. And `Revise` goes well with modules, in which case, if you had defined a module `MyModule` in a file `MyModule.jl`, with the functions of `analyze.jl` and `report.jl`, such as

```julia
module MyModule
  include("analyze.jl")
  include("report.jl")
  export analyze, report
end

```

loading it with

```julia
using Revise
using MyModule # if you are in the folder where "MyModule.jl" is*

```

you will be able to modify the functions inside those files and they will be always be automatically updated at every new call in the REPL.

These options do not work if you redefine a data structure. Then you have to restart over. I usually keep also a script which just runs the above commands to restart the developing section when that is needed, starting julia with `julia -i devel.jl`.

\*If you want to load the module from other folder, you need to add that folder to the `LOAD_PATH`, with:

```julia
 push!(LOAD_PATH,"/path/to/MyModule")

```

(I don’t like this much, is there a way to just point directly to the module file?)

---

_[View the full topic](https://discourse.julialang.org/t/julia-repl-flow-coming-from-matlab/50499)._
