完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
电子发烧友论坛|
您好,我正在尝试将通过GPIB连接的E5071C网络分析仪编程到带有matlab的PC。
这是我第一次编程远程控制设备,所以我遇到了一些困难。 我的目标是在手动设置和校准后,能够通过matlab脚本进行4端口自动循环测量。 阅读该仪器的网络帮助和一些在线学习,我能够做一些部分。 希望它能做到我所期待的,但无论如何我无法保存测量结果。 成功连接设备后,这就是我正在做的事:fprintf(g,'ABORT'); / *中止最终的测量并将触发器设置为空闲fprintf(g,'TRIG:SOUR BUS'); / *通过gpib命令fprintf设置触发器生成(g,'INItiATE:IMMEDIATE'); / *设置启动时间fprintf(g,'TRIG:SING'); / *生成触发器并执行测量fprintf(g,'* OPC?'); / *查询测量状态(用于继续脚本的结果位)fprintf(g,':MMEMory:STORe:SNP:TYPE:S4P 1,2,3,4'); / *选择4端口试金石格式fprintf(g,':MMEMory:STORe:SNP:FORMat RI'); / *选择实/虚格式fprintf(g,':MMEMory:STORe:SNP:DATA D: test.s4p'); / *保存数据最后一个保存数据的命令失败。 我尝试了几次更改包含文件名的字符串的方式,但我总是得到一个错误说错误的格式或缺少参数。 谁能给我一个关于我在哪里犯错误的线索? 代码的前一部分是否正确? 在此先感谢您的帮助。 以上来自于谷歌翻译 以下为原文 Hello, I'm trying to program a E5071C network analyzer connected via GPIB to a pc with matlab. It's the first time I'm programming to remotely control a device so I'm facing some difficulties. My goal is to be able to do 4-port automatized cyclic measurements run by a matlab script after manual setting and calibration. Reading the web help of the instrument and some exaple online, I was able to do some part of it. Hopefully it does what I am expecting, but anyway I'm not able to save measurements. After succesfully connect with the device, this is what I'm doing: fprintf(g, 'ABORT'); /* to abort eventual meaasurements and set the trigger to idle fprintf(g, 'TRIG:SOUR BUS'); /*to set trigger generation via gpib command fprintf(g, 'INITIATE:IMMEDIATE'); /* to set the initiation tate fprintf(g, 'TRIG:SING'); /* to generate trigger and execute measurements fprintf(g, '*OPC?'); /* query for status of measurements (result bit to be used to continue the script) fprintf(g, ':MMEMory:STORe:SNP:TYPE:S4P 1, 2, 3, 4'); /*to select 4 port touchstone format fprintf(g, ':MMEMory:STORe:SNP:FORMat RI'); /* to select real/imaginary format fprintf(g, ':MMEMory:STORe:SNP:DATA D:test.s4p'); /* to save data The last command, to save data, fails. I tried several times changing the way the string containing the file name is written but I always get an error saying wrong format or missing parameter. Can anyone give me a clue on where I'm doing a mistake? Is the previous part of the code correct? Thanks in advance for any help. |
|
相关推荐
4个回答
|
|
|
你好,我的强项是PNA比ENA还要强,但是在我看来,你的文件名字符串本身缺少必要的引号。
我不熟悉matlab,但我希望它像C / C ++,当你想要定义一个包含一个或多个引号的字符串时:''fprintf(g,':MMEMory:STORe:SNP:DATA 'd: test.s4p ''); 以上来自于谷歌翻译 以下为原文 Hello, my forte is the PNA more-so than ENA, but it looks to me you're lacking necessary quotes around your file name string itself. I'm not fluent in matlab but I expect its like C/C++ where when you want to define a string that contains one or more quotes you'd do: ' fprintf(g, ':MMEMory:STORe:SNP:DATA 'D:test.s4p''); |
|
|
|
|
uwyywefwd 发表于 2018-12-19 12:41 > {quote:title = bhokkan写道:} {quote}>您好,我的强项是PNA比ENA更强,但它看起来你缺少文件名字符串本身的必要引号。 我不熟悉matlab,但我希望它像C / C ++一样,当你想要定义一个包含一个或多个引号的字符串时:'>> fprintf(g,':MMEMory:STORe:SNP: DATA 'D: test.s4p ''); 可能不清楚,但最后一个字符是两个单引号,而不是一个双引号,因为在'''not “中,你可能必须”逃避“如fprintf(g,':MMEMory:STORe:SNP: DATA 'D:\ test.s4p '');注意我最后添加了一个空格以便清晰。而且很多scpi解析器都没有关于单引号或双引号的错误,所以你可以说fprintf(g,': MMEMory:STORe:SNP:DATA“D: test.s4p”');也许如果你在win7上有一些UAC问题写入不同的驱动器所以首先尝试用简单的文件名写入本地目录 “test.s4p”,看看是否有效。 以上来自于谷歌翻译 以下为原文 > {quote:title=bhokkan wrote:}{quote} > Hello, my forte is the PNA more-so than ENA, but it looks to me you're lacking necessary quotes around your file name string itself. I'm not fluent in matlab but I expect its like C/C++ where when you want to define a string that contains one or more quotes you'd do: ' > > fprintf(g, ':MMEMory:STORe:SNP:DATA 'D:test.s4p''); might not be clear but the last character is two single quotes, not one double quote as in ' ' not " also, you might have to "escape" the as in fprintf(g, ':MMEMory:STORe:SNP:DATA 'D:\test.s4p' '); note I added a space for clarity at the end. And a lot of scpi parsers are not finnicky about single or double quotes so you can say fprintf(g, ':MMEMory:STORe:SNP:DATA "D:test.s4p" '); And maybe if you are on win7 there is some UAC issues with writing to a different drive so try first to write to the local directory with a simple file name "test.s4p" and see if that works. |
|
|
|
|
|
谢谢你们两位的答案。 我实际上也试过几种形式的引号和本地目录但没有成功,但可能不在你建议的配置中。 我会对此进行测试,希望它能够正常工作。 以上来自于谷歌翻译 以下为原文 Thanks both of you for the answers. I actually tried also with quotes in several forms and also to local directory without success, but probably not in the configuration you suggested. I'll test this and hopefully it'll work. |
|
|
|
|
|
有用。 我用过:fprintf(g,':MMEMory:STORe:SNP:DATA“D: test.s4p”'); 我还有一个问题。 并不重要,因为我可以做到这一点。 我的目的是将文件从网络分析仪传输到控制它的电脑。 显然,要使用的函数是::MMEMory:TRANsfer,但我不清楚参数块所指的是什么。 再次感谢您的回答。 以上来自于谷歌翻译 以下为原文 It works. I used: fprintf(g, ':MMEMory:STORe:SNP:DATA "D:test.s4p" '); I have an additional question. Not crucial, as I can do this otherways. My intention was to transfer the file from the network analyzer to the pc controlling it. Apparently, the function to be used is: :MMEMory:TRANsfer , But it is not clear to me what the parameter block refers to. Thanks in advance again for any answer. |
|
|
|
|
只有小组成员才能发言,加入小组>>
1844 浏览 0 评论
2739 浏览 1 评论
2640 浏览 1 评论
2449 浏览 5 评论
3458 浏览 3 评论
1844浏览 0评论
416浏览 0评论
/9
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2025-12-1 21:41 , Processed in 0.527251 second(s), Total 48, Slave 41 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191

淘帖
2567