Thread Subject: fread repetition factor

Subject: fread repetition factor

From: Ralph Page

Date: 30 Jul, 2010 22:29:06

Message: 1 of 3

I am using:
DataValues=fread(fid,'2304*uint8',116);
To read in 2304 bytes, then skip 116 bytes and repeat for the entire file.
Works great.
I'd like to make the 2304 value a variable.
So far I have been unsuccessful, is it possible?

Thanks,

Ralph Page

Subject: fread repetition factor

From: Walter Roberson

Date: 30 Jul, 2010 22:32:47

Message: 2 of 3

Ralph Page wrote:
> I am using:
> DataValues=fread(fid,'2304*uint8',116);
> To read in 2304 bytes, then skip 116 bytes and repeat for the entire file.
> Works great.
> I'd like to make the 2304 value a variable.
> So far I have been unsuccessful, is it possible?

DataValues=fread(fid,sprintf('%d*uint8',BytesToRead),116);

Subject: fread repetition factor

From: Ralph Page

Date: 30 Jul, 2010 23:07:21

Message: 3 of 3

Walter Roberson <roberson@hushmail.com> wrote in message <i2vk6a$nu$2@canopus.cc.umanitoba.ca>...
> Ralph Page wrote:
> > I am using:
> > DataValues=fread(fid,'2304*uint8',116);
> > To read in 2304 bytes, then skip 116 bytes and repeat for the entire file.
> > Works great.
> > I'd like to make the 2304 value a variable.
> > So far I have been unsuccessful, is it possible?
>
> DataValues=fread(fid,sprintf('%d*uint8',BytesToRead),116);

Thanks Walter, works great

Tags for this Thread

Everyone's Tags:

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Tag Activity for This Thread
Tag Applied By Date/Time
fread Ralph Page 30 Jul, 2010 18:29:08
rssFeed for this Thread

Contact us at files@mathworks.com