# Replacing MATLAB/Octave with Julia

**URL:** <https://discourse.julialang.org/t/replacing-matlab-octave-with-julia/136558>\
**Category:** General Usage\
**Created:** [April 4, 2026, 4:04pm UTC](https://discourse.julialang.org/t/replacing-matlab-octave-with-julia/136558 "2026-04-04T16:04:43Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![AntonioBigazzi](https://avatars.discourse-cdn.com/v4/letter/a/c89c15/32.png) [@AntonioBigazzi](https://discourse.julialang.org/u/AntonioBigazzi)\
**Post date:** [April 4, 2026, 4:04pm UTC](https://discourse.julialang.org/t/replacing-matlab-octave-with-julia/136558/1 "2026-04-04T16:04:43Z")

</div>

I’d love to move to Julia, but MATLAB/Octave has a feature that is indispensable to me: the echo of each instruction ( unless terminated with a ; )

ax = -0.8  
ay = 0.6  
bx = 0.7241 etc.

Is there an equivalent way, in Julia, like an echo mode, to get the same result?  
Thanks in advance.

---

<div class="post-metadata">

**Author:** ![stevengj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stevengj/32/71_2.png) [@stevengj](https://discourse.julialang.org/u/stevengj)\
**Post date:** [April 4, 2026, 4:08pm UTC](https://discourse.julialang.org/t/replacing-matlab-octave-with-julia/136558/2 "2026-04-04T16:08:08Z")

</div>

Usually you just put `@show` in front of each line where you want to echo the output.

e.g. running a script

```julia-auto
a = 3
b = 4
@show c = sqrt(a^2 + b^2)
@show d = c + 1
x = [a,b,c,d]

```

prints

```julia-auto
c = sqrt(a ^ 2 + b ^ 2) = 5.0
d = c + 1 = 6.0

```

---

<div class="post-metadata">

**Author:** ![lilachint](https://avatars.discourse-cdn.com/v4/letter/l/ee7513/32.png) [@lilachint](https://discourse.julialang.org/u/lilachint)\
**Post date:** [April 4, 2026, 4:13pm UTC](https://discourse.julialang.org/t/replacing-matlab-octave-with-julia/136558/3 "2026-04-04T16:13:29Z")

</div>

There’s a thread on [StackOverflow](https://stackoverflow.com/a/74589689) on this exact topic.

```julia
macro echo(code)
    for i in eachindex(code.args)
        typeof(code.args[i]) == LineNumberNode && continue
        code.args[i] = :( display($(esc(code.args[i]))) )
    end
    return code
end

```

```julia-repl
julia> @echo begin
           ax = 2
           ay = 3
           b = ax * ay
       end
2
3
6

```

Credit: [Przemyslaw Szufel](https://stackoverflow.com/users/9957710/przemyslaw-szufel)

I modified it a bit:

```julia
macro echo(code)
       for i in eachindex(code.args)
           typeof(code.args[i]) == LineNumberNode && continue
           code.args[i] = esc(:(@show $(code.args[i])))
       end
       return code
end

```

```julia-repl
julia> @echo begin
           ax = 2
           ay = 3
           b = ax * ay
       end
ax = 2 = 2
ay = 3 = 3
b = ax * ay = 6
6

```

See which one you prefer.

---

<div class="post-metadata">

**Author:** ![stevengj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stevengj/32/71_2.png) [@stevengj](https://discourse.julialang.org/u/stevengj)\
**Post date:** [April 4, 2026, 4:16pm UTC](https://discourse.julialang.org/t/replacing-matlab-octave-with-julia/136558/4 "2026-04-04T16:16:15Z")

</div>

That being said, most people in Julia use other workflow styles. See also the thread: [Best practise: organising code in Julia - #2 by stevengj](https://discourse.julialang.org/t/best-practise-organising-code-in-julia/74362/2)

If you want to work quasi-interactively and see lots of intermediate outputs, one alternative is to use a Jupyter notebook (IJulia.jl) or Pluto notebook (Pluto.jl) — every code block in its own cell gets a displayed output saved in the notebook, and you can easily go back and edit and view intermediate steps without necessarily re-running the whole thing (though Pluto automatically re-runs all downstream calculations).

---

<div class="post-metadata">

**Author:** ![Nathan\_Boyer](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nathan_boyer/32/14825_2.png) [@Nathan\_Boyer](https://discourse.julialang.org/u/Nathan_Boyer)\
**Post date:** [April 17, 2026, 7:24pm UTC](https://discourse.julialang.org/t/replacing-matlab-octave-with-julia/136558/5 "2026-04-17T19:24:24Z")

</div>

If you use Visual Studio Code as your Julia IDE, it has a command to send one line (or block) at a time to the REPL and display the output. It can also display the output in an overlay next to the line itself. You can set one or both of these command to a keyboard shortcut of your choosing and then step through a file by repeatedly pressing it to see each result.

 ![image](https://global.discourse-cdn.com/julialang/original/3X/4/6/46888c7e8bd8dbe8a175826a6e45a2a9917a04ee.png)  
 ![image](https://global.discourse-cdn.com/julialang/original/3X/f/2/f2f7144e8a0787267de2c048abd248e227ef69a6.png)  
 ![image](https://global.discourse-cdn.com/julialang/original/3X/b/9/b973c95bd84b4b62ca92624235045c34ed0f3fc7.png)
