# Single type Binary reading

**URL:** <https://discourse.julialang.org/t/single-type-binary-reading/33993>\
**Category:** New to Julia\
**Tags:** binaryio\
**Created:** [January 30, 2020, 6:00pm UTC](https://discourse.julialang.org/t/single-type-binary-reading/33993 "2020-01-30T18:00:45Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jrson](https://avatars.discourse-cdn.com/v4/letter/j/49beb7/32.png) [@jrson](https://discourse.julialang.org/u/jrson)\
**Post date:** [January 30, 2020, 6:00pm UTC](https://discourse.julialang.org/t/single-type-binary-reading/33993/1 "2020-01-30T18:00:45Z")

</div>

Hi, I am a new to Julia, and I need some help.

```
% Load data in Matlab
fileID = fopen('./data_6000x3199.bin');
Data = fread(fileID,[6000,3199],'single');
fclose(fildID);

```

How can I convert this simple code from Matlab to Julia?

---

<div class="post-metadata">

**Author:** ![Tamas\_Papp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tamas_papp/32/25949_2.png) [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Post date:** [January 31, 2020, 10:47am UTC](https://discourse.julialang.org/t/single-type-binary-reading/33993/2 "2020-01-31T10:47:15Z")

</div>

I don’t know the `.bin` format — if you can describe that, it is more likely that you will get help.

If it is just a bunch of `Float32`s, it may be something as simple as

```julia
data = zeros(Float32, 6000, 3199)
read!("data_6000x3199.bin", data)

```

---

<div class="post-metadata">

**Author:** ![giordano](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/giordano/32/2166_2.png) [@giordano](https://discourse.julialang.org/u/giordano)\
**Post date:** [January 31, 2020, 11:26am UTC](https://discourse.julialang.org/t/single-type-binary-reading/33993/3 "2020-01-31T11:26:18Z")

</div>

For the record, this is a cross-post from StackOverflow (where the question was already answered): [How to read binary file in Julia? - Stack Overflow](https://stackoverflow.com/q/59991708/2442087)
