Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations cowski on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

forcing variable data type

Status
Not open for further replies.

JeffEriksen

Bioengineer
Aug 13, 2007
4
I thought Matlab now let you force data types, so that not everything is automatically a double. I am using 7.0 R14. I want to declare variables as type int16 or int32 before reading them in from a binary file. When I do so, however, they still end up as type double. How can I force them to be integer type using only 2 or 4 bytes each? Example:

int16 variable
variable = fread(fid, 1, 'int16')
 
Replies continue below

Recommended for you

Hi,

read carefully the documentation... and try this :

Code:
variable = fread(fid, 1, '*int16');

or

Code:
variable = fread(fid, 1, 'int16=>int16');

Jérôme
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor