% MATLAB for low-level reading of 32bit-floating point numbers
f=fopen(‘Float32.dat’,‘r’);
A=fread(f,[100 inf],‘single’); % important for me to use inf
fclose(f);

Question: What Julia-code do I have to insert for the question marks?

I’m new to Julia coming from Matlab and tired of license gymnastics. I found out, that there are a couple of features in Julia that are better than in Matlab (you don’t have to repmat a vector to add it to a matrix) but I even get stuck in elementary stuff. I’ve tried to search for an answer for the above question but I didn’t find anything, not even in the pdf-manual from Julia. Please tell me, if there is anything I haven’t considered. There are even packages for reading MAT-Files but there is no example for this simple elementary low-level reading of Float32-numbers shown above (instead string, CSV and UInt8). To my feeling there must exist an easy one-liner solution in Julia. I would be happy to have an example.
Wishing you a nice evening
Zweta Fuze

@GHL
Thank you so much. That is what I needed. Incredible, that there is no example of this one in the documentation but tons of (U)Int8, CSV, strings and textfiles. Now I found out, it even works with matrices like
A=Array{Float32}(undef,100,filesize(“Float32_100xN.dat”)÷sizeof(Float32)÷100);
read!(“5kHz.f32”,A)
I need this for reading multichanneldata, that are sampled with 24bit but stored in floats of 32bit. That’s what it does. Sure it would have been more comfortable being able to use [100 inf] like in Matlab, but I can live with this solution. Thank you very much.

@jling
raw Float32
These are data of a multichanneldevice. Data could be produced by
write(“Float32_100xN.dat”,randn(Float32,100,10000))
In Matlab this could be read with
f=fopen(‘Float32_100xN.dat’,‘r’);
A=fread(f,[100 inf],‘single’);
fclose(f);
I learnt up to now that in Julia obviously you have to replace inf by 10_000 in this case. Thank you for your interest.

My configuration is the following
Julia Version 1.4.1
Platform Info:
OS: Linux (x86_64-linux-gnu)
CPU: Intel(R) Core™ i3-4130 CPU @ 3.40GHz
WORD_SIZE: 64
LIBM: libopenlibm
LLVM: libLLVM-8.0.1 (ORCJIT, haswell)
Thank you for your interest

Thanks for sharing your solution, glad we could help
Maybe have a look at: Please read: make it easier to help you
which explains code formating, etc. to make it easier to help you and for others to also profit from your questions.