Creating Instrument Object Array for GPIB communication

5 vues (au cours des 30 derniers jours)
Stefan
Stefan le 25 Nov 2011
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.

Réponses (0)

Catégories

En savoir plus sur Instrument Control Toolbox dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by