フィルターのクリア

'fclose()' causes matlab to hang, am I missing a toolbox?

2 ビュー (過去 30 日間)
Phillip
Phillip 2014 年 5 月 2 日
コメント済み: David Rea 2018 年 5 月 23 日
I am running a simple instrument control script using the visa command:
dpo4104 = visa('NI', 'USB0::0x0699::0x0401::C021522::0::INSTR');
fopen(dpo4104);
query(dpo4104,'*IDN?');
fclose(dpo4104);
which seems to execute fine, but the fclose function causes MATLAB to hang. I can't ctrl-c the process, and I can't do anything to resolve the problem except killing my MATLAB process and restarting.
The fclose() function works in other cases, as I can pass in an undefined object identifier and it will throw an error.
Please help!
  1 件のコメント
Adam
Adam 2014 年 8 月 7 日
This may not be relevant as I am not familiar with what query does, but due to the way file buffering and access generally works the time spent doing the file access will usually show up as the fclose line as it does the heavy work there.
So when I have run profile in the past my e.g. fread instruction takes next to no time, but fclose takes a surprisingly long time. In my case it was really the file reading that took the time, it is just that the time taken to do this is assigned to the fclose line of code.
I'm sure there are others with far more expertise in the details of file buffering though and when work actually happens on different file access instructions.

サインインしてコメントする。

回答 (3 件)

Vinod
Vinod 2014 年 5 月 20 日
Have you tried this with a different instrument (other than your DPO4104)? Also, what version of NI VISA are you using?

Liz Dreyer
Liz Dreyer 2014 年 7 月 28 日
Did you solve this problem?
I am having a similiar issue. fclose() is causing MATLAB to hang when I try to close a VISA-USB object. It works when I communicate with a serial object.
Thanks!
  1 件のコメント
Leah Leonard
Leah Leonard 2016 年 11 月 21 日
I am also having this issue, did anyone ever find a solution?

サインインしてコメントする。


Walter Roberson
Walter Roberson 2016 年 11 月 21 日
  1 件のコメント
David Rea
David Rea 2018 年 5 月 23 日
I am using Matlab 2018a and I have an issue similar to this.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeInstrument Control Toolbox についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by