I m using the gpib read command to recieve data from a gpib instrument. I already know the form of the binary data being sent back. I have programmed it in matlab before. I am haveing trouble parseing out the binary data I recieve. the basic form of the data is
#I immediately followed by 401 64 bit ieee floating point numbers. When I programmed this in matlab the code I used was of the form:
[a,count,msg]=fread(g2,2,'int8');
[a,count,msg]=fread(g2,401,'float64');
for those that don't know matlab code the command reads data from the instrument pointed to by the g2 handle. the number after the g2 above speicifies the number of values to read. And the last part the string in qoute specifies the way the binary data
is to be interepeted. the output arguments a count and msg are
a-your data
count-number of items succesfully read in
msg-error message
In the above two lines I use the variable a twice to capture the data. The first time a is set equal to '#I' everything inside the qoutes. The second time a is set equal to the actual data, in this case 401 64bit floating point numbers. I m convince that the flatten to string and unflatten from string function are the set meant to accomplish this task. But I haven't been able to find a good example of how to use these functions. Especially with an array.
Can some one please help me?
Thanks
Scourched