How can I efficiently handle binary data in UDP packets using instrument control toolbox?

2 views (last 30 days)
I am reading binary packets using the instrument control toolbox's udp object. My plan is to read the full packet as binary data and use typecast to modify the data to other types as necessary. matlab/fread supports specifying the precision with an asterisk to indicate that the output should use the same format as the input (i.e. '*uint8' means read 8-bit values and return 8-bit values instead of converting each 8-bit value to double), but instrument/fread does not. The documentation says 'By default, numeric values are returned in double-precision arrays.'
Is there some way to specify a different return type for instrument/fread? Or do I really have to receive doubles and then convert them back to the desired type? (My guess is that bit would be a performance killer.)
matlab/fread also supports 'machinefmt'. Is there a way to take advantage of that with instrument/fread?

Answers (0)

Categories

Find more on Instrument Control Toolbox in Help Center and File Exchange

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!