Main Content

spoll (visa)

(To be removed) Perform serial poll on VISA objects

This visa object function will be removed in a future release. Use visadev object functions instead. For more information, see Compatibility Considerations.


out = spoll(obj)
out = spoll(obj,val)
[out] = spoll(obj)
[out,statusByte] = spoll(obj)
[out] = spoll(obj,val)
[out,statusByte] = spoll(obj,val)



A VISA object or an array of VISA objects.


A numeric array containing the indices of the objects in obj, that must be ready for servicing before control is returned to the MATLAB® Command Window.


The VISA objects ready for servicing.


The service request (SRQ) line status byte.


out = spoll(obj) performs a serial poll on the instruments associated with obj. out contains the VISA objects that are ready for servicing. If no objects are ready for servicing, then out is empty.

out = spoll(obj,val) performs a serial poll and waits until the instruments specified by val are ready for servicing. An error is returned if a value specified in val does not match an index value in obj.

Using this syntax, spoll blocks access to the MATLAB Command Window until the objects specified by val are ready for servicing, or a timeout occurs for each object specified by val. The timeout period is specified by the Timeout property.

[out] = spoll(obj) returns the object or an array of objects.

[out,statusByte] = spoll(obj) returns the status byte along with the object or an array of objects.

[out] = spoll(obj,val) returns the object and the value specified in the index value of the object.

[out,statusByte] = spoll(obj,val) returns the status byte along with the object and the value specified in the index value of the object.


If obj is a four-element array and val is set to [1 3], then spoll will block access to the MATLAB Command Window until the instruments connected to the first and third VISA objects have both requested servicing, or a timeout occurs.

Example of second output argument:

v1 = visa('keysight', ''); 
v2 = visa('keysight', ''); 
fopen([v1 v2]);
out1 = spoll(v1);
out2 = spoll([v1 v2], 1);
out3 = spoll([v1 v2], [1 2])
[out4 statusBytes] = spoll([v1 v2])
[out5 statusBytes] = spoll([v1 v2], 2)
fclose([v1 v2]);


Serial polling is a method of obtaining specific information from VISA objects when they request service. When you perform a serial poll, out contains the VISA object that have requested servicing.

If obj is an array of VISA objects

  • Each element of obj must have the same BoardIndex property value.

  • Each element of obj is polled to determine if the instrument is ready for servicing.

If you specify a second output argument when you call an spoll, full serial poll bytes are returned in addition to the SRQ line status in the second argument.


To get a list of options you can use on a function, press the Tab key after entering a function on the MATLAB command line. The list expands, and you can scroll to choose a property or value. For information about using this advanced tab completion feature, see Using Tab Completion for Functions.

Compatibility Considerations

expand all

Not recommended starting in R2021a

Introduced in R2010a