If you want to read / write data to a binary file in a specific format, you must use the FREAD / FWRITE functions . For example, this will write 100 random values to a file in the form of 32-bit floats:
A = rand(1,100);
fid = fopen('temp.dat','wb');
fwrite(fid,A,'float32');
fclose(fid);
For more information about the IO file in MATLAB, you can also check out these other related SO posts: here and here .
source
share