MATLAB: Matlab equivalent of long(data(0:7),0,2) Combine two 4 bytes to get an integer

idl eqvivalent

Hi
What is the matlab equivalent of long(data(524:532),0,2) Where data is an array of type bytearray.
For non idl users….
I am reading a binary file using type ( uint8 ) into an array. Each element of array represents one byte of data. How do I combine 4 bytes to get the equivalent integer value. Can this be extended to get float8 long.
GlanPlon

Best Answer

typecast(TheByteArray, 'int32')
This will take each group of 4 bytes and turn them into signed 32 bit.
typecast(TheByteArray, 'double')
This will take each group of 8 bytes and turn them into double.