How can I control a GPIB device's parameters from GUI?
4 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Hi,
I wrote a GUI to get the trace from an optical spectrum analyzer (OSA) Ando AQ6317 and to do some processing on that spectrum. My GUI is based on this awesome code: https://www.mathworks.com/matlabcentral/fileexchange/32721-getosatrace.
Anyway, everything works, with a pushbutton I can get the spectrum, analyze it and plot whatever I need. Now I want not only to do this, but also to control the OSA parameters (central wavelength, span, etc.) from my GUI. The communication between the laptop and the OSA is done via a GPIB interface, and obviously the OSA has its commands / program codes for that. For example, the command to change the central wavelength is "CTRWL****.**", so in the Matlab command window I can just write
"query(g1,'CTRWL800')"
and it will do the job. Now the problem is that if I want to change this parameter from my GUI, I need to create an Edit Text and tag it with let's say CWL. So I thought that the command line in the relevant m-file would have been
"query(g1,'CTRWL handles.CWL')"
but unfortunately this is not working. The symbols **.** after CTRWL should be numbers.
Do you think it is possible to solve this problem?
0 comentarios
Respuesta aceptada
dpb
el 30 de Nov. de 2016
Sure, just build a command string to send...but in
query(g1,'CTRWL handles.CWL')
the 'CTRWL handles.CWL' is a literal string, not the result of the control appended to the other string.
cmd=['CTRWL' handles.CWL.String]; % retrieve value; append to command string
query(g1,cmd)
Do you want query to set a control parameter? (Don't know, haven't done GPIB w/ Matlab, only directly w/ NI Fortran libraries so don't know the toolbox)
1 comentario
Más respuestas (0)
Ver también
Categorías
Más información sobre Instrument Control Toolbox Supported Hardware en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!