# Julia equivalent of Python (numpy.savetxt) and Matlab (save) commands?

**URL:** <https://discourse.julialang.org/t/julia-equivalent-of-python-numpy-savetxt-and-matlab-save-commands/41738>\
**Category:** Data\
**Created:** [June 19, 2020, 5:44pm UTC](https://discourse.julialang.org/t/julia-equivalent-of-python-numpy-savetxt-and-matlab-save-commands/41738 "2020-06-19T17:44:22Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![jipolanco](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jipolanco/32/12129_2.png) [@jipolanco](https://discourse.julialang.org/u/jipolanco)\
**Post date:** [June 19, 2020, 6:18pm UTC](https://discourse.julialang.org/t/julia-equivalent-of-python-numpy-savetxt-and-matlab-save-commands/41738/3 "2020-06-19T18:18:15Z")

</div>

The easiest way is to use `writedlm`, but that won’t give you the exact same formatting:

```julia
using DelimitedFiles
p = [1, 2]
q = [3, 4]
writedlm("pqfile.txt", (p, q), " ")

# Output:
# 1 2
# 3 4

```

If you want more control over the formatting you can write the file manually using the `@printf` macro and iterating over the arrays.

---

_[View the full topic](https://discourse.julialang.org/t/julia-equivalent-of-python-numpy-savetxt-and-matlab-save-commands/41738)._
