function [y]=ibquery(c,text)
%IBQUERY write string to GPIB device via DDE and read answer.
%   c must be a channel handle obtained from DDEINIT('GPIB',<devicename>),
%   and one version of DDEGPIB.EXE must run.
%   <text> and <y> are always text.
%
%   See also DDEINIT, MEXGPIB.

%   h#s 12/00


if nargin>2,
  error('Too many input arguments, must be 2.');
end

if nargin<2,
  error('Insufficient input arguments, must be 2.');
end

if ddepoke(c,'data',text)~=1,
  error('Can''t write data to GPIB device, invalid handle or connection timeout.');
end

y=ddereq(c,'data',[1 1]);

