Error 116 at Unflatten from string.....

Hi I want to save and load the control values of
the tab pages I am getting the following error
"Error 116 occurred at Unflatten From String     
      Unflatten or byte stream read operation
failed due to corrupt, unexpected, or truncated data."
  the attached is the VI can
anyone tell me what is wrong ….thank you
Attachments:
save n load example.vi ‏70 KB

All that you need to do is right-click on the Read from Text File and Write to Text File functions and uncheck "Convert EOL".
Other comments:
You should not hard-code the path inside the VI. Either place a front panel control to specify the path (perhaps with a default value set), or generate the path so that it is relative to the VI (such as being in the same directory as the VI).
You are not wiring all your errors through so some errors can be lost.
You do not need to have the VI open a reference to itself. If you delete the Open VI Reference function the code will still work.

Similar Messages

  • Error 74 Unflatten from String in video streaming using TCP

    I am working on video streaming ( source: USB camera) using TCP. However, am constantly getting held up in "Unflatten from String" with Error 74 occuring stating "Memory corrupt". Kindly help me through in solving the issue.
    Attached is the VI having both the send/ recieve together and communicating using localhost. 
    Attachments:
    Image acquisition & transmit.vi ‏189 KB

    Shoaib Akhtar wrote:
    Thanks  for the reply!
    Restricting the TCP sent dta to two bytes was a mistake, that has been rectified.
    However, we are unable to resolve the "Unflatten from String". their just doesn't seem to be any sub-VI or function, that I can find which could convert the string to IMAQ image!
    Kindly help in the same!
    Best. 
    Actually at least in earlier versions of IMAQ the normal Unflatten from string should be able to createthe IMAQ image when you transmit the right data. You can try that by writing the string from IMAQ Flatten.. to a file and reading it back and unflattening. If that works, you know you are making some errors in the TCP communication.
    Message Edited by rolfk on 01-11-2010 08:37 AM
    Rolf Kalbermatter
    CIT Engineering Netherlands
    a division of Test & Measurement Solutions

  • CRIO: Unflatten from string into lvclass not working in deployment

    Hello,
    I am working on a problem for some hours now and I need some help.
    I am using a cRIO-9022. I need to do some tasks, and I created a couple of classes which contain the parameters and the methods. They contain using dynamic dispatch VIs. I have an array of these classes (all derived from a parent class) which is my "configuration". I am using "flatten to string" and saving those file on disk. "Unflatten from string" is working fine. These file is created on a LV WIndows Application.
    I need to use this file on my cRIO: Unflatten from string, and then work with the array of my classes. When running the cRIO Main VI it's working fine. But when building the application and deploying it as startup, it's not working. I am getting:
    Error 1403 occurred at Unflatten From String in Gantry CommEngine.vi->RT Main.vi
    Possible reason(s):
    LabVIEW:  Attempted to read flattened data of a LabVIEW class. The data is corrupt. LabVIEW could not interpret the data as any valid flattened LabVIEW class.
    What I tried so far:
    - Added the whole lvlib containing the classes and also every single class to "Source files / always included".
    - Created constants of the array (containing the classes) to the VI (forcing LV to include the classes?)
    - Loaded the file from cRIOs flash and also by shared variable
    What else can I do?
    Thanks a lot for support!

    I tried to reproduce the matter, but couldn't. 
    I attached my example to the post. 
    What it does:
    It creates a class with only a string a bool and a number. This class oblect is saved to C:/somename.xml. The number is a random number.
    In the second case the same file is read and the number broadcasted to a variable.
    It worked quite fine building it as a startupexe.
    Nothing else was necessary. Does it work for you?
    Attachments:
    class exe.zip ‏45 KB

  • Unflatten from string takes long time to execute in x64

    Hi All,
    I am running into an issue where "Unflatten from String" is taking enormous amout of memory n time in LV 2012 SP1 x64 to execute. I pass in a NOT flattened string to this function and it consumes ~5 Gigs of memory and takes more than 10 minutes to execute it. On x86, it executes almost instantly.
    It only happens if the input is not a flattened string. 
    Is this a known bug?
    I have attached the vi here for you to see the problem. If you run it on x64, it might take more than 10 mins to execute and your system will be in a hung state. 
    Ritesh
    Attachments:
    Flat String to Data bug.vi ‏9 KB

    LVCoder wrote:
    With "x64" I meant LV x64. It executes instantly on LV x86 running on Win 64 bit but on LV x64 it takes like eternity. 
    I know it cannot unflatten it and I want it to return an error. My actual code can receive a flattened or NOT flattened string and I have a case structure which handles different strings differently. 
    Be careful with that terminology, it only applies to the Windows Operating System with respect to 32-bit and 64-bit processors.  There is no such thing as LabVIEW x64, or LabVIEW x86.  The property terminology is LabVIEW 32-bit (the most common one, most people use, even on 64-bit OS's since it is the most fully supported), and LabVIEW 64-bit (not commonly used, doesn't have full support of all add-on modules and toolkits, and is mainly only used by people who need LabVIEW to analyze very large datasets.)

  • Whats happening internally within the unflatten from string function?

    I am getting unflatten from string error intermitently in my program. I can't post the program to get help but essentially I am storing a GOOP object reference as a string. The reference is flattened to a string and stored upon creation, at a latter time the string is then unflatterned to retrieve the reference and then the data. This works most of the time but occansionaly the unflatterned from string function fails. Prior to passing the string to the function I am checking that the string isn't null. I am assuming something else is corrupting the string prior to passing to this fucntion and would like to know what would trigger the error in the function as it may help me realise what is happening
    prior.
    Cheers,
    Wayne

    Hi,
    It really seems strange this problem, but one thing that might be the cause is how you store the flatten string. You do not mention that. I have once had problems when storing GOOP references as a sting and passing them between test VIs in TestStand using a string parameters in TestStand. A flatten string might have special chars that not all applications (such as TestStand parameters) can handle that and just trunkate the string when such a char is present, mistakenly inteprets that as end of string. Have you tried to check that string length is the same?
    However to make sure you get rid of all problems with string termination, you really should cast your GOOP reference into something else. I would instead cast the reference to an U32, or
    if you want, to solve the string problem for other types than GOOP reference, then flatten the type into string and then convert the string to an array of U8 before storing it. This would by sure solve your problem.
    Regards,
    Mattias Ericsson
    Endevo
    Sweden
    Main developer of the new GOOP2 and GOOP Wizard 3.
    PS! Have you seen that there is a new GOOP release that also may handle inheritance? Please check out: http://www.endevo.se/default.asp?lang=eng and click on "Products". There are examples, demos and white papers describing the new GOOP Inheritance Toolkit.
    Attachments:
    CastRefExample.vi ‏18 KB

  • Bug in "Unflatten from String" (LV7)

    I have binary files with different versions of a certain datatype. When loading a file, I try to unflatten the data using the newest dataversion. If I get an error, I try the 2nd newest dataversion and so on until I found the right datatype. This methode was ok up to LV6.01.
    Now I updated to LV7.0ger and I found following bug:
    When unflatting certain binary datas from string I get an error msg window "Nicht genügend Speicher zum Abschließen dieser Operation". The error-output of the vi is incorrect.
    Does anybody know a workaround of that bug?
    You can test the bug with the attached vi. Include also the two typedefs.
    Attachments:
    f_mancalib_UnflattenTypeCalibList.vi ‏184 KB
    f_mancalib_TypeCalibrationParams.ctl ‏24 KB
    f_mancalib_TypeCalibrationList.ctl ‏28 KB

    Hi,
    From the LV's help: "National Instruments recommends reworking any
    application that uses the Convert 4.x Data mode as a long term solution.".
    Data types may vary with differenct versions of LabVIEW. So, if types are
    not the same, this does not need to be a bug. Right click the Unflatten From
    String, and select Convert 4.x Data. This might not work, because the data
    is stored with Lv 5 or 6, but when you get it working, it will keep working
    for future versions of LV.
    The attached VI shows that a sting in a cluster does not convert to the same
    type string for lv4.x and lv7. Perhaps they are the same for lv4.x and lv6.
    If so, using convert 4.x data would be sufficient. If not, you need to read
    the data in 6, save the binary 4.x strings
    , and use 4.x from then on.
    You might also do the following: (also from the help) "If you use this
    function to flatten data from a custom control or indicator that you saved
    as a type definition, the function strips the type definition of its type
    definition wrapper. If you do not want to strip this wrapper, right-click
    the function and select Expose Typedefs from the shortcut menu."
    Regards,
    Wiebe.
    "albertz" wrote in message
    news:[email protected]..
    I allready told this to a NI tech support in Germany. They told me,
    the bug is known, but they do?nt have a workaround.
    So I hope for LV7.1 or maybe LV7.01.
    [Attachment Different Types.vi, see below]
    Attachments:
    Different_Types.vi ‏22 KB

  • How does "Unflatten From String" take a type and return a value of that type?

    http://zone.ni.com/reference/en-XX/help/371361E-01/glang/unflatten_from_string/
    How exactly does the "type" argument for "Unflatten From String" work? I need to create a VI that takes a type, passes it as an argument to several calls of the "Unflatten From String" function, and returns an array containing elements of the type originally passed. The "Unflatten From String" function seems to do some magic though, because the type of the "value" that it outputs changes depending on the type it is passed as input. How do I do the same magic in my VI?
    Ultimately, what I need to accomplish is an unflatten-list operation. Given a type T and a byte string of length L (which contains a concatenation of T elements that are flattened to their bytes), create a VI that unflattens all the types in the string and return an array of length (L / sizeof(T)) that contains each type.
    Note: performing the unflatten-list operation is trivial, but I cannot for the life of me figure out how to do it in a VI that takes a type and returns an array of the appropriate type. By the way, my data is being given to me from another source, so please don't bother suggesting that I should be flattening an array using LabVIEW's "Flatten To String" function in the first place. My data is not given in LabVIEW's array format: http://zone.ni.com/reference/en-XX/help/371361B-01/lvconcepts/flattened_data/
    Thanks a ton!
    -Wakka

    Take a look at this example:  You can see that the flattened string contains several bytes.  The first four bytes contain the length of array (number of elements).  Since the data type is U32, the next 32 bits (4 bytes) contains the value of the first element, and so on.  Could you possibly use this scheme to do what you want to do?  Other data types present different outputs.  You would have to experiment with them.
    - tbob
    Inventor of the WORM Global

  • How do I unflatten from string to an array of strings in labwindows

    New to Labwindows so please forgive.  I am trying to use STM to read messages from an existing LabView program.  I am using ClientTCPCB from the example that came with the STM library, but it reads in doubles, I want to read in strings.  I can see that I have the correct number of elements in my receive buffer, but I can't figure out how to convert the receive buffer into an array of char arrays (or strings as it were) something like labview's "unflatten from string" with 1-d array of strings as the type.

    So I figured it out... from the lack of info on the web and forums I doubt it will be useful to anyone else, but will post a brief solution.
    So I dumped the raw bytes to a file to look at how they are packed.  The first 4 bytes (int) is the number of strings in the message.  The next 4 bytes (int) are the number of chars that follow, then the corresponding chars, sans any null term character, then the very next int would be the number of chars in the next string and so on and so forth.  So I ended up writing my own charArrUnflatten function.  Anyway, after all this I might try to recode everything to use network vars.  Cheers.

  • Unflatten From String causes runtime error in LV2009

    I found this error when trying suggestions made in this thread.
    http://forums.ni.com/ni/board/message?board.id=170&thread.id=458335
    Unflaten from string causes runtime Error 74 possible reason(s) Memory or data structure corrupt.
    Attachments:
    Unflatten runtime error.vi ‏8 KB
    error1.jpg ‏13 KB

    Of course you are getting the error. The data types are inconsistent. You convert the cluster to an array. You then define the type of flattened string as a cluster. Either don't convert to an array or define the data type as an of paths. Look again at the examples in that post.

  • How do I avoid Error 85 in Scan From String scanning VISA read buffer?

    I have encountered an Error 85 with my Scan From String VI. I have a timed
    loop to read data from a device (flowmeter) using a serial port. This device takes
    periodic measurements and sends the reading which contains a numerical value to the serial port COM1. It cannot be read continuously, and the period
    between measurements may vary, so I decided a timed loop would be better than a while loop.
    The VI begins with VISA Configure Serial Port and then
    goes to a VISA Write which sends the message to the device to begin
    taking measurements. After this, the device usually says "TAKE FLOWMETER READINGS" to the terminal, thereafter only sending numbers. Then begins my timed loop containing VISA Read. I
    am taking the read buffer two places.
    First, I am taking it to an Array to Spreadsheet String with the
    Format String %.3f, as was in the Write to Text File example. Then I am
    using Concatenate Strings with this string and also a string containing
    the System Time. This string goes to Write to Text File, which I have
    configured using Open/Create/Replace File outside of the loop.
    Second, I am taking the read buffer to a waveform chart. I thought
    it would be a good idea to use Scan From String to convert the string
    into a DBL which I am then sending to the waveform
    chart.
    I am not sure if the initial "TAKE READINGS" message is giving me an error. I was able to get one reading saved to my text file from the device.
    Also the format string for my Scan From String is %.3f
    I am getting the Error 85 at the Scan From String only sometimes.
    When this happens, there is no data being written to the text file. But
    other times, I get data and it writes to the text file just fine (but
    rounds to nearest whole number).
    Any help would be greatly appreciated! This serial port device has been giving me a lot of trouble.

    Is this what you mean? Did I wire the shift registers correctly?
    I didn't know if you meant to Concatenate before Scan From String or Concantenate before or after VISA Read?
    Message Edited by YeungJohn on 11-20-2008 03:48 PM
    Message Edited by YeungJohn on 11-20-2008 03:49 PM
    Attachments:
    SerialShiftVI.JPG ‏87 KB

  • Unflatten From String Not Functioning in Mobile Module 2011

    Mobile Module does not get updated since version 2011. I am not sure my question will be solved. 
    I have been using Simple Messaging Reference Library (STM) for a couple of years. I use them in my Mobile Module code too. It has been working fine until lately I updated to the latest version of STM.
    I noticed that 'Read Message (TCP).vi' was not functioning properly in the Mobile Module code. After a long debugging, I found the source of the problem. 'Unflattern From String.vi' does not work in Mobile Module any more. I did a test as shown above. 
    My questions are
    1). 'Unflattern From String' was changed so it is not supported in Mobile Module 2011?
    2) Why the same code worked before, but not now?
    I use LabVIEW 2011 and Mobile Module 2011. Thanks. 

    MengHuiHanTang wrote:
    Mobile Module does not get updated since version 2011. I am not sure my question will be solved. 
    I have been using Simple Messaging Reference Library (STM) for a couple of years. I use them in my Mobile Module code too. It has been working fine until lately I updated to the latest version of STM.
    I noticed that 'Read Message (TCP).vi' was not functioning properly in the Mobile Module code. After a long debugging, I found the source of the problem. 'Unflattern From String.vi' does not work in Mobile Module any more. I did a test as shown above. 
    My questions are
    1). 'Unflattern From String' was changed so it is not supported in Mobile Module 2011?
    2) Why the same code worked before, but not now?
    I use LabVIEW 2011 and Mobile Module 2011. Thanks. 
    Is that the real code or just a mockup to demonstrate the issue?  I'm asking because the code is set up to run once and then wait until the stop button is pressed.  Then the VI will complete and exit.  Is the the desired behavior?
    Bill
    (Mid-Level minion.)
    My support system ensures that I don't look totally incompetent.
    Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.

  • Strange problem with unflatten from string

    Hi all,
    Attached are the VIs that make me crazy.
    The problem is simple, Creat fake signal creats datas and uses a strict type def control (cluster) then this cluster is flatten to a string and written into a text file.
    Test read opens one of that file and unflatten the datas with the same stric type def. There is the problem it does not work!
    If I wire a cst arry into the data terminal of the bundle by name, then there is no problem. By if I wire other array it does not work always... It seems random.....
    I hope that somebody can help me. Even people reproducing the error are welcome, to know if it comes from my computer.
    Thanks a lot for the help
    Attachments:
    vis.zip ‏43 KB

    I changed the write to binary sting file with write to binary file and it seemed to fix the problem. I had to change it in your gen fake data file too.
    Tim
    Johnson Controls
    Holland Michigan
    Attachments:
    vis.zip ‏44 KB

  • Error 74 in unflatten to string

    Hi,
    The attached VI opens a file in read\write mode. If the file doesnt exist it creates a file. The next time when the vi is run the created file is read. If the file already exists then it only reads the file. The data is a cluster which is converted to binary using flatten to string function and then written to the file using write binary file function. When I read back the file, I get the error 74.
    My observation :  The flatten to string output is different from what it is written to the file. Some special character is added to the starting of the file.
    But i dont face any problem when i replace the read binary file or write binary file with the read text file and write text file respectively.
    Regards
    Gopal
    Attachments:
    Default_Setup.vi ‏30 KB

    The "Write to Binary File" VI has an input "prepend array or string size". Wire a False to this input and your VI will work as expected.
    Side note: You seem to be relying on the "Automatic Error Handling" in LabVIEW. I would recommend not doing this, and following the convention of having an error in/error out cluster for VIs. In your VI any error that gets generated is not being passed out.

  • Unflatten from xml on class in lvlib

    I am using Flatten To XML and Unflatten From XML on a class in LV2009.  This works fine until I put the class in a lvlib.  Then the Unflatten From XML returns an error 1527: Attempted to read flattened data of a LabVIEW class that is not currently loaded into LabVIEW.  In my test case the flatten and unflatten are in the same VI, so the class was there when it was flattened.
    Any help is appreciated.

    I don't know of a good workaround at this time if the class has to be inside a LabVIEW library. I tried a few things that I hoped would work that didn't:
    Bundling the class into a single-element cluster before flattening to XML, then unflattening and unbundling.
    Inserting the class into a Variant before flattening. Then unflatten as a variant and do Variant to Data. This would have added a <LVVariant> tag to the XML, but otherwise would have been harmless.
    Trying the same with a single-element array of the class.
    None of those worked. The best workarounds I have for you if the class is inside a library are:
    Manually serialize and unserialize the class contents to XML using LabVIEW's XML Dom parser. This is a decent amount of work, and won't work with other XML files you create using LabVIEW's default schema.
    Flatten the class to string using Flatten to String. Then wire the string into the Flatten to XML. To get the data out, Unflatten from XML as a string, then Unflatten from String into your class. The XML text isn't pretty or really representative of the data stored in it, but hey, it at least saves and loads the data.
    Jarrod S.
    National Instruments

  • Write-read binary file Error 116

    Hi all,
    I am saving double, numeric array data into a binary file and then trying to read it back but keep on getting Error 116 (cannot read from binary file).
    I have attached screenshots of the way I am writing my data into the binary file and then the way I am trying to read it. Basically my data is chunks of 2D double arrays, coming at a rate of 1hz and this is why I have to use the get and set file size functions prior to saving into the file (i.e. so that each time I can append my file with new data).
    I have tried all combinations for the write to binary and read to binary file functions, thus meaning I have tried little, big and native endian options but I keep getting the same error. Also played with the way I append my data, i.e. I have used both the "offset in bytes" and "end of file" options, just in case this made any difference, but again no luck.
    Any help would be much much appreciated.
    Regards,
    Harry
    Solved!
    Go to Solution.
    Attachments:
    Write_Bin.JPG ‏154 KB
    Read_Bin.JPG ‏100 KB

    Just as an amendment to my original post, I can succesfully read my data in MATLAB using the standard fread function with double precision. I presume that this means that there is nothing wrong with the way I write the data into the file. However, it would be useful for me to be able to read it directly from Labview without having to build matlab executables etc etc...
    cheers again

Maybe you are looking for

  • BAdi for Statistical Posting F-38 & F-55

    Hi Experts, I am going to add additional fields in AR and AP - Statistical posting, F-38 and F-55 I try to look for BADI to maintain it, i came across FI_HEADER_SUB_1300IM, with that, i am able to add the fields for FB01 but it seems cannot be added

  • Difference in stock

    Hi We are dealing with two products.One is manufactured items(we manufacture) & traded products(we buy it &sell).The issue is the increase/decrease in stock value appearing in P/L  is not tallying with the same in balance sheet.Below is the details o

  • I would like to know if there a way to use window (via bootcamp) and use a dual screen with the use of thunderbolt?

    I would like to know if there a way to use window (via bootcamp) and use a dual screen with the use of thunderbolt?

  • Problem with runing .exe

    i have already add NI_Vision_Acquisition_Software.lvlib into the projekt. But when i runing the .exe it still seems to short of some NI_Vision_Acquisition_Software.lvlib. Can some1 help me? Thank you very much!

  • About MD81 customer individual requirements ?

    Hi Gurus, can anybody Explain How To maintain CIR in MD81 . i want to maintain CIR in MD81 but not able to understand it properly. after entering material and plant there are different errors coming. please help me to understand CIR . .is it possible