MATLAB: Instrument control toolbox, problem communicating with instrument

communication instrument control

I am able to communicate with my instrument (Signal Recovery 7270 DSP Lock-in Amplifier) only 1 out of 2 times. The signal send from fprintf always get to the instrument, but I can read from it only 1 out of 2 time. I am sure the command send to the instrument is right. I am sure that the command get to the instrument because it has a communication monitor where I can read the commands that have been send to it and the answer it will send.
Here is my code:
vu = visa('NI', 'USB0::0x0A2D::0x001B::11117372::0::RAW');
>> fopen(vu)
>> fprintf(vu,'ID')
>> fscanf(vu)
Warning: Unsuccessful read: VISA: Unknown status value 0xBFFF0015
ans =
''
>> fprintf(vu,'ID')
>> fscanf(vu)
ans =
7270
>> fprintf(vu,'VER')
>> fscanf(vu)
Warning: Unsuccessful read: VISA: Unknown status value 0xBFFF0015
ans =
''
>> fprintf(vu,'VER')
>> fscanf(vu)
ans =
2.00
>> fclose(vu)

Best Answer

The fprintf and fscanf were not send correctly.
I have to use:
fprintf(vu,'%s', 'MAG'); %Reads Magnitude in volts
fscanf(vu, '%c\n');
And that way it works!
Hope it can help someone one day.