So, while using Fread to open a 4 byte I used uint32 and uint64 for 8 byte value. But what should i do if i want to read a 12 byte value.( for a 6 byte i used ubit(6*8) but cant use 12*8. Any suggessions?
    11 Ansichten (letzte 30 Tage)
  
       Ältere Kommentare anzeigen
    
Fread(fid, (precision) *ubit48, skip bytes) for a 6 byte value , so what precision should I use for 12 byte value? Thank you
0 Kommentare
Antworten (1)
  Jan
      
      
 am 30 Apr. 2016
        data = fread(fid, 12, '*uint8');
Now you have the 12 single bytes. You can join the first 8 byte to a UINT64 using typecast:
low  = typecast(data(1:8),  'uint64');
high = typecast(data(9:12), 'uint32');
But you see, that you cannot store the result in an integer tyoe with 96 bits directly, because Matlab does not habe such a type. Search for "Matlab vpa" to learn how to use arithmetics with variable precision.
3 Kommentare
  Walter Roberson
      
      
 am 1 Mai 2016
				You cannot do that for 12 byte values. Instead loop reading 12 buttons at a time and then fseek() forward by the skip.
If you have a sequence that regular you should consider using memmapfile
Siehe auch
Kategorien
				Mehr zu Large Files and Big Data finden Sie in Help Center und File Exchange
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


