hardware discovery using instrhwinfo

15 visualizaciones (últimos 30 días)
KiungChung Wong
KiungChung Wong el 25 de Nov. de 2015
Comentada: Vinod el 28 de Nov. de 2015
I am developing this little app. There is a "Find" button when it is clicked, I would like to scan for all available hardware connected to my system and then show a list of VISA address that is available.
Below is the code snippet using instrhwinfo to do this job. If this is the right way ?
visainfo = instrhwinfo('visa', 'agilent');
if ( isempty(visainfo.ObjectConstructorName) )
fprintf('No VISA instrument is found');
else
for n = 1:length(visainfo.ObjectConstructorName)
obj = eval(visainfo.ObjectConstructorName{n});
visaInstruments{n} = get(obj, 'RsrcName');
fprintf('%s\n', visaInstruments{n});
end
end
Based on the description for instrhwinfo, 'visa' is the interface and 'agilent' is the adaptor. Question is, if I create a standalone application using application compiler and share to user, does user need to install Agilent VISA library in order to use this application or everything will be provided by the Matlab runtime ?
In other words, any dependency for application using instrument control toolbox ?

Respuesta aceptada

Vinod
Vinod el 25 de Nov. de 2015
Your standalone application will require the user of the application to install any 3rd party drivers such as Agilent VISA. Without this, your compiled code on a machine without Agilent VISA will fail to find Agilent VISA as the VISA libraries are attempted to be loaded up at run time.
  2 comentarios
KiungChung Wong
KiungChung Wong el 26 de Nov. de 2015
How to check during run time in the code, for example Agilent VISA is not installed, so that the little app can feedback to user to install it.
Vinod
Vinod el 28 de Nov. de 2015
This would be the kind of code you can use.
someVariable = instrhwinfo('visa');
if isempty(someVariable.InstalledAdaptors)
% If we are here, it means the user doesn't have a compatible installed VISA
msgbox('Please install a compatible VISA installation');
else
% Check to see if you have agilent visa installed
% App code here...
end

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Instrument Control Toolbox Supported Hardware en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by