# Conversion from string to matrix

**URL:** https://discourse.julialang.org/t/conversion-from-string-to-matrix/105109
**Category:** General Usage
**Tags:** parsing, complex-numbers, matrix
**Created:** [October 18, 2023, 9:27am UTC](https://discourse.julialang.org/t/conversion-from-string-to-matrix/105109 "2023-10-18T09:27:08Z")
**Posts on this page:** 1
**Showing post:** 4

<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: [October 18, 2023, 12:15pm UTC](https://discourse.julialang.org/t/conversion-from-string-to-matrix/105109/4 "2023-10-18T12:15:33Z")

</div>

> [@HanD](#):
>
> If you want to persist data so that it can be used later, and you don’t care about human readability, then the easiest option is to use the `Serialization` library:

You can also just use comma-delimited text, e.g. via the `DelimitedFiles` library or several other libraries:

```julia
julia> using DelimitedFiles

julia> writedlm("cpx.csv", [1.0 + 1.0im 1.0 + 0.0im; 5.0 + 0.0im 0.0 + 0.0im], ',')

julia> readdlm("cpx.csv", ',', ComplexF64)
2×2 Matrix{ComplexF64}:
 1.0+1.0im 1.0+0.0im
 5.0+0.0im 0.0+0.0im

```

These have the advantage of being more human-readable and more portable across Julia versions.

See also the discussion thread: [Saving an array of complex numbers](https://discourse.julialang.org/t/saving-an-array-of-complex-numbers/23653)

---

_[View the full topic](https://discourse.julialang.org/t/conversion-from-string-to-matrix/105109)._
