Main Content


Specify size of output buffer in bytes


You configure OutputBufferSize as the total number of bytes that can be stored in the software output buffer during a write operation.

An error occurs if the output buffer cannot hold all the data to be written. You write text data with the fprintf function. You write binary data with the fwrite function.

You can configure OutputBufferSize only when the instrument object is disconnected from the instrument. You disconnect an object with the fclose function. A disconnected object has a Status property value of closed.



Any instrument object

Read only

While open

Data type



The default value is 512 bytes.


This example shows how to set the output buffer size for a serial port object. The OutputBufferSize property specifies the maximum number of bytes that can be written to the instrument at once. By default, OutputBufferSize is 512 bytes. There could be a case when you would want to limit it to less than the default size.

Create a serial port object associated with the COM1 port. Set the output buffer size to 256 bytes.

s = serial('COM1');
s.OutputBufferSize = 256;

See Also


fprintf, fwrite