Writing GPIB Commands in App Designer

4 次查看(过去 30 天)
Hello Matlab Community,
I am trying to migrate a labview VI functionality to matlab App Designer. We previously collected data through labview, then plotted it to matlab. We are using an HP4396B Spectrum/Network Analyzer. The hardware is really old and can't communicate with modern drivers. I would mirror the type of programming this example uses - https://www.mathworks.com/help/instrument/examples/reading-inphase-and-quadrature-iq-data-from-a-signal-analyzer-over-tcp-ip.html#d120e1234 - There is an oscilliscope example - https://www.mathworks.com/matlabcentral/fileexchange/69847-oscilloscope-app - that scans for local instruments and connects to a desired resource. It has the ability to change channels while inserting specific parameters.
I would love something similar so my team can input desired start/stop freqeuncy ranges, update the settings, run a single sweep, then plot the data to a UIAxes. I am able to connect to the instrument in a startupFcn, but when it comes to using fprintf, nothing happens. For example the command [fprintf(app.obj1, 'FORM4;CORR 0')] does not write to my analyzer when viewing the Test and Measurement Tool Communicate tab.
Note, having the fprintf commands work in a regular *.m script, but does not execute when placing them in my *.mlapp script. Last week was spent researching and I can't find any YT video or documentation over the syntax.
Sorry if this answer was already asked.
Thanks!
  3 个评论
Blake Morrell
Blake Morrell 2021-4-27
What problem are you dealing with? I found that my analyzer was entering an error state along the way. I was remotely building this application without actually viewing my analyzer screen haha. What resloved my issue was sending a reset command.
To further build my application, I downloaded the oscilliscope app in my post, opened it and viewed the code. This helped tremendously for building mine from scratch.
Kristoffer Franzén
I'm trying to migrate TestPoint functionality to Matlab for doing hall measurements among other things. I need to communicate with several instruments over GPIB. I'm trying to get them to return an id in the startupFcn but to no avail.
I wasn't really sure where in the generated code it's best practice to connect to the instruments, so I thought I'd shoot a question your way, seeing that you also connected at the startupFnc.
Now I gather this is the way to go. I'll sure check the code for the oscilloscope and my instruments.
Thank you for taking your time to answer and for good tips!

请先登录,再进行评论。

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Develop Apps Using App Designer 的更多信息

标签

产品


版本

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by