Using fread to read streaming binary data from ethernet using Instrument Control Toolbox

My data are uint8 format. The documentation for fread seems to imply that the "precision" argument can set the output format of fread. But if I try to use precision='*uint8' or 'uint8=>uint8' I get an error. The default output is double, which takes too much memory. I've been using
Output=uint8(fread(TcpipObj,SIZE,'uint8'))
which works, but I'm guessing this generates a large array of doubles then converts to uint8.
My instrument streams data until the buffer is full, so I set up TcpipObj.InputBufferSize to pull in the data I need. I then set SIZE to the same value. I'd like to pull in 40 MB or so, but get a java heap memory error.
Suggestions?
Jim

4 件のコメント

Walter Roberson
Walter Roberson 2012 年 4 月 20 日
What error do you get with those precisions ?
Sean de Wolski
Sean de Wolski 2012 年 4 月 20 日
You could increase your java heap memory. But, like Walter, I'm curious what the error message has to say.
James Watson
James Watson 2012 年 4 月 24 日
I seem now to have a hardware problem that's preventing me from reproducing the error and giving you a look at it. I'll try to reply when I get that squared away.
James Watson
James Watson 2012 年 7 月 18 日
My instrument is back from repair! The error I get is Java exception occurred: java.lang.OutOfMemoryError: Java heap space at com.mathworks.toolbox.instrument.InputBuffer.getDataFromBuffer(InputBuffer.java:705) at com.mathworks.toolbox.instrument.InputBuffer.getDataWithInfo(InputBuffer.java:528) at . . . plus several more lines that I can type out if anyone is interested.
It appears that fread in basic Matlab and fread in the instrument toolbox are different functions with different input variables allowed.

サインインしてコメントする。

カテゴリ

ヘルプ センター および File ExchangeInstrument Control Toolbox についてさらに検索

質問済み:

2012 年 4 月 20 日

Community Treasure Hunt

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

Start Hunting!

Translated by