<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">Dear all,<div><br></div><div>When I read a binary file, which contains a head, I first need to get some information from the head. The head contains several variables in different types, such as in Fortran:</div><div><br></div><blockquote style="margin: 0 0 0 40px; border: none; padding: 0px;"><div>type head</div><div>&nbsp; &nbsp; character(16) a</div><div>&nbsp; &nbsp; integer(2) b</div><div>&nbsp; &nbsp; real(4) c</div><div>end head</div></blockquote><div><br></div><div>The binary file is written in C format (I think, it is from other guys). I tried to use `cbinread` to read the head as:</div><div><br></div><blockquote style="margin: 0 0 0 40px; border: none; padding: 0px;"><div>head = cbinread(“…”, 22, “character”)</div></blockquote><div><br></div><div>So now I get an array of characters. The character string `a` can be easily extracted as:</div><div><br></div><blockquote style="margin: 0 0 0 40px; border: none; padding: 0px;"><div>a = charactertostring(head(0:15))</div></blockquote><div><br></div><div>But what about `b` and `c`? How do I get them from head(16:17) and head(18:21)? I didn’t find some functions that can take several bytes and combine them to form other desired types.</div><div><br></div><div>Thanks in advance!</div><div><br></div><div>Best regards,</div><div><br></div><div>Li</div></body></html>