# How to use \`readdlm\` to read in a Matrix{Char}

**URL:** <https://discourse.julialang.org/t/how-to-use-readdlm-to-read-in-a-matrix-char/123464>\
**Category:** General Usage\
**Tags:** question\
**Created:** [December 4, 2024, 5:08pm UTC](https://discourse.julialang.org/t/how-to-use-readdlm-to-read-in-a-matrix-char/123464 "2024-12-04T17:08:47Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jling](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jling/32/212909_2.png) [@jling](https://discourse.julialang.org/u/jling)\
**Post date:** [December 4, 2024, 5:08pm UTC](https://discourse.julialang.org/t/how-to-use-readdlm-to-read-in-a-matrix-char/123464/1 "2024-12-04T17:08:47Z")

</div>

Sometimes it’s useful to read in the file as a matrix of characters, in other words, split on empty char – but currently, `readdlm(path, dlm::Char)` the second argument has to be a `Char` and there’s no empty Char. am I missing something?

The current workaround is not too bad:

```julia
    stack(readlines(path); dims=1)

```

---

<div class="post-metadata">

**Author:** ![carstenbauer](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/carstenbauer/32/4981_2.png) [@carstenbauer](https://discourse.julialang.org/u/carstenbauer)\
**Post date:** [December 4, 2024, 7:38pm UTC](https://discourse.julialang.org/t/how-to-use-readdlm-to-read-in-a-matrix-char/123464/2 "2024-12-04T19:38:27Z")

</div>

I believe we already had the same - or a very similar question - during last years Advent of code. 😉

---

<div class="post-metadata">

**Author:** ![carstenbauer](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/carstenbauer/32/4981_2.png) [@carstenbauer](https://discourse.julialang.org/u/carstenbauer)\
**Post date:** [December 4, 2024, 7:40pm UTC](https://discourse.julialang.org/t/how-to-use-readdlm-to-read-in-a-matrix-char/123464/3 "2024-12-04T19:40:28Z")

</div>

It was even by you 😀

> [@How to read a textfile directly as \`Matrix{Char}\`](https://discourse.julialang.org/t/how-to-read-a-textfile-directly-as-matrix-char/107070):
>
> it’s that time of the year again, say we have: 467..114.. ...\*...... ..35..633. ......#... 617\*...... .....+.58. ..592..... ......755. ...$.\*.... .664.598.. in a file, and we want: julia\> mapreduce(permutedims∘collect, vcat, readlines("./a.txt")) 10×10 Matrix{Char}: '4' '6' '7' '.' '.' '1' '1' '4' '.' '.' '.' '.' '.' '\*' '.' '.' '.' '.' '.' '.' '.' '.' '3' '5' '.' '.' '6' '3' '3' '.' '.' '.' '.' '.' '.' '.' '#' '.' '.' '.' '6' '1' '7' '\*' '.' '.' …
