Timeout expired before operation completed

76 views (last 30 days)
Madeline Kane
Madeline Kane on 29 Jun 2023
Answered: Andrei on 22 Nov 2023
g=visadev("GPIB::18::INSTR")
visadevlist and visadev are not supported on Linux.
writeline(g,"Display:Contrast")
data=readline(g)
Hello, I am currently trying to read and write to my PSA spectrum analyzer. visadev is successfully connecting it, but I writeline and readline, when added into my code, always get the "Timeout expired before operation completed" error message. I do not understand why this is not working and how I can fix it. Any advice is greatly apprectiated!

Answers (2)

Adit Kirtani
Adit Kirtani on 5 Jul 2023
Hi Madeline,
From the issue you have described in your question, I have understood that the write operation has not finished within the default time to complete a write operation. You can change this value by using the following code snippet:
timeout_duration = 20 %Change to whatever value you wish
v = visadev( "GPIB::18::INSTR");
v.timeout = timeout_duration
%Now perform your write / read operations
You can view more details regarding the read and write properties of the visadev object using this documentation link:
I hope this helps,
Adit Kirtani

Andrei
Andrei on 22 Nov 2023
A couple of suggestions:
See also:

Community Treasure Hunt

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

Start Hunting!