% Open connection to instrument with IP address 89.10.66.41
ud=mexrsib('ibfind', '89.10.66.41')

% Check for valid device handle
if ud > 0
    
    % Set timeout to 10 s
    mexrsib('ibtmo',ud,10)

    % Init device
    mexrsib('ibwrt',ud,'*RST;*CLS')

	% Identify the instrument
    mexrsib('ibwrt',ud,'*IDN?')
    IdStr = mexrsib('ilrd',ud,100)

    % Turn display update ON
    mexrsib('ibwrt',ud,'SYST:DISP:UPD ON')

    % Select single sweep
    mexrsib('ibwrt',ud,'INIT:CONT OFF')

	% Perform one sweep and wait for operation to complete
    mexrsib('ibwrt',ud,'INIT;*OPC?')
    y=mexrsib('ilrd',ud,1)

    % Select binary data transfer
    mexrsib('ibwrt',ud,'FORM:DATA REAL,32')
    
    % Read trace data
    mexrsib('ibwrt',ud,'TRACE? TRACE1')
    
    % Read trace data header
    y=mexrsib('ilrd',ud,2)
    y=mexrsib('ilrd',ud,4)

    % ... and now the measurement data
    x=mexrsib('ilrd32',ud,2500/4);
    plot(x);grid;

    % Set instrument to local
    mexrsib('ibloc',ud)

end
