Extract float data from a binary file

Dear Expert,
I Want to read a binary file consist of float and char format as following:
struct PP
{
char name[9];
float x,y,z,m,n,p,q,r;
};
How can I extract only float data from the binary file with fread .

 Accepted Answer

fid = fopen(myfile,'r') ;
str = fread(fid,9,'*char')' ;
num = fread(fid,9,'*float') ;
fclose(fid) ;

More Answers (0)

Asked:

on 29 Apr 2019

Answered:

on 30 Apr 2019

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!