That brings me to the question, how should the header file looks like and are there any special requirements building the *.dll to use it in Matlab? The Matlab function loadlibrary requires two arguments, the *.dll and the header file.Here is a sample of how to read a file line by line using the basic file IO commands in Matlab File Opening, Writing to a File, Reading from a File. First you should be familiar with the builtin function textread, as it is the simplest form of file input available in Matlab.