what's the difference in single and float when reading data with fread function.
21 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
In the help documation of fread function,there are senven kinds of datatypes which are listed below. single 32 (4) double 64 (8) float 32 (4) float32 32 (4) float64 64 (8) real*4 32 (4) real*8 64 (8)
And the result value is the same when i use "single" and "float32" and that the datatype is not single or float32 but double.IS it right?If right,what's the difference in single and float when reading data with fread function.
The matlab code is pasted below. fp = fopen(strCombineOutputFile); if(fp == -1) errordlg('File not found','File Error'); return; end for i=1:1320 OutputCombineSlice1{i} = fread(fp,[720,2],'single'); %OutputCombineSlice1{i} = fread(fp,[720,2],'float32'); end
0 Kommentare
Akzeptierte Antwort
Iain
am 27 Aug. 2014
fread has a habit of reading the correct data type, but returning it as a double.
float and single should be identical.
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Predictive Maintenance Toolbox finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!