Creating Instrument Object Array for GPIB communication

4 visualizaciones (últimos 30 días)
Stefan
Stefan el 25 de Nov. de 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.

Respuestas (0)

Categorías

Más información sobre Instrument Control Toolbox en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by