Pass deviceObj between callbacks in app

조회 수: 2 (최근 30일)
Christopher Saltonstall
Christopher Saltonstall 2020년 2월 28일
댓글: Maadhav Akula 2020년 3월 3일
I am able to make VISA-USB connection in one callback but want to maintain this connection and pass the device object between callback so that I can perform various commands on the connection. How do I do this? I tried adding it to the app property but i get an error.
function ConnectButtonPushed(app, event)
% Create a VISA-USB object.
interfaceObj = instrfind('Type', 'visa-usb', 'RsrcName', 'USB0::0x0699::0x03A6::C041227::0::INSTR', 'Tag', '');
% Create the VISA-USB object if it does not exist
% otherwise use the object that was found.
if isempty(interfaceObj)
interfaceObj = visa('NI', 'USB0::0x0699::0x03A6::C041227::0::INSTR');
else
fclose(interfaceObj);
interfaceObj = interfaceObj(1);
end
% Create a device object.
deviceObj = icdevice('tektronix_tds2024.mdd', interfaceObj);
% Connect device object to hardware.
connect(deviceObj);
end
  댓글 수: 1
Maadhav Akula
Maadhav Akula 2020년 3월 3일
It would be helpful if you can share your error message.

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 App Building에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by