This content is not available in your preferred language.

The content is shown in another available language. Your browser may include features that can help translate the text.

Error 85 Occured at Scan From String Function in LabVIEW

Updated Oct 20, 2023

Reported In

Software

  • LabVIEW

Driver

  • NI-VISA
  • NI-488.2

Issue Details

  • When using the Scan From String function, I get Error 85 occurred at Scan From String (arg 1). This can come up when I am using the function directly, or am trying to communicate with a serial or GPIB instrument using VISA functions. Why do I see this error? 
  • Why does the Scan From File function in LabVIEW return error code 85, Scan failed. The input string does not contain data in the expected format.? I get error code 85 despite the fact that I am using the same format string that I used with the Format Into File function.
 

Solution

The error is generated when input string does not contain the information expected by the Scan String. You can define the Scan String by right clicking the Scan From String function, and selecting Edit Scan String.
 
When a file includes a string that contains spaces, the Scan From File function interprets a space character as the end of the string. Thus, LabVIEW starts scanning for the next output in the middle of the string rather than at its end, which causes this error.

You can fix this by using multiple format specifiers to individually scan each part of the string that precedes or follows a space in your file, as the Scan From File function interprets spaces as the end of the string.

As the following block diagram illustrates, this workaround requires a different format string than one used with the Format Into File function to format data as text and save it to a file. You then can concatenate the strings to match the original string. 
If you are trying to communicate with an instrument through VISA functions, ensure that the string being sent to the instrument is in the instrument's intended format, and that you are using the proper GPIB or serial cable.

Additional Information

The Scan String specifies what values the Scan From String function looks for, which can either be numbers or strings. The error occurs if the scan cannot find all of the values it is expecting in the order specified by the Scan String.

The table below shows the results for the Scan From String function with several different settings:
 
Input StringFormat String (Scan String)String ExplanationOutput 1Output 2Remaining String
123abc123%fScan number123 abc123
123abc123%f %fScan number, Scan numberErrorErrorError
123abc123%f %sScan number, Scan string123abc123 
123abc
123
%f %sScan number, Scan string123abc123

In most cases, this error can be disregarded, but you might want to take a closer look at your scan string. There are a few ways to work around this error:
  • Make sure the input string contains the information expected by the Scan From String VI.
  • Use a General Error Handler VI to programmatically control how LabVIEW handles the error. Wire the error out from the Scan From String function to the error in of the General Error Handler VI. If you use this VI and wire no Dialog to the type of dialog input terminal, LabVIEW ignores the errors.
  • Ignore only Error 85 by following guide How Do I Ignore a Specific Error in LabVIEW? detailing how to ignore a particular error. 
  • The last way to avoid this warning/error from popping up is to disable all error handling. If you do not use any error handling VIs, all warnings and errors are ignored by LabVIEW.