Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TugboatEng 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
Joined
Aug 13, 2007
Messages
4
Location
US
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')
 
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

Back
Top