Creating Instrument Object Array for GPIB communication

조회 수: 5 (최근 30일)
Stefan
Stefan 2011년 11월 25일
Hi,
I'm trying to communicate with some lab equipment via GPIB. I kind of made it work but I'm still having some problems.
The basic code is very simple:
g=gpib('ni',0,1) %create GPIB object
out=instrfind('Type','gpib')
fopen(out)
fprintf(out,['*IDN?'])
fscanf(out)
fclose(out)
The first time I run this programm works fine. But when running it again the instrument array increases by 1 and it looks like this:
*Index: Type: Status: Name:
1 gpib closed GPIB0-1
2 gpib closed GPIB0-1*
and it gives the error:
??? Error using ==> icinterface.fprintf at 77 OBJ must be a 1-by-1 interface object.
And then I have to restart Matlab since I have no idea how to clear this interface object. Nothing I tried worked so far. So you can imagine it's pretty annoying.
Does anybody of you have some experience with communication via GPIB?
Thanks a lot.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Instrument Control Toolbox에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by