From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

ViScanf invalid format string due to #sample size data1, data2,... response

I'm writing a program which will utilize the internal memeory of the Agilent 34410A DMM for making fast measurements (10K/s).  In order to do this, I need to setup a test, have the data stored to the internal memory, then read and delete it, while other measurements are still happening.  The best command for the read/delete function is the R? command, but it returns the data in a strange format which breaks the ViScanf format string.  

 

an example of the R? reading in below:

 

R? 2

#231+2.87536000E-04,+3.18131400E-03

 

Is there a way to setup the ViScanf format string to handle this?

 

Thanks

 

Ryan

 

0 Kudos
Message 1 of 6
(3,970 Views)

Just a guess without trying it myself, did you consider the format string

 

%*[^\n]

 

to discard the first line?

0 Kudos
Message 2 of 6
(3,960 Views)

So you mean this?  If so, I no longer get the error, but all my data is 0.00.

 

viScanf (vi, "%*[^\n]", fbuf);

0 Kudos
Message 3 of 6
(3,947 Views)

What NI software are you using? CVI? 

Seems like this forum post here talks about a similar issue.

National Instruments
Applications Engineer
0 Kudos
Message 4 of 6
(3,923 Views)

Yes, I am using CVI

 

If it was just returning one value I would use a simple viScanf function like this:

 

viScanf (vi, "%f", fbuf);

 

If you do a READ from in the instrument, it returns an array of floats so you need to adjust you viScan fuction parse the string into an array of floats like this (array of 500 for this example):

 

viScanf(vi, "%,500f", fbuf);

 

The problem is the data response to the R? command starts with the array size and is then followed by the data (#231+2.87536000E-04,+3.18131400E-03).  In the previous example, I need to delete the #, and parse the 231 into an array size variable and then fill an array (fbuf in this case) with the data.

0 Kudos
Message 5 of 6
(3,913 Views)

While my earlier comment was meant as suggestion of how to discard the first line

 

R? 2

 

I'll try again with a suggestion that includes your second line:

 

%*[^#]%d%,500f

 

The %*[^#] is supposed to discard everyting until the '#' character, with %d you read the integer value, and then follows your array of floats

 

0 Kudos
Message 6 of 6
(3,909 Views)