Save Labview Class to file?

Hi there,
I am playing around with the new Labview classes and i am thinking working with classes is pretty cool.
But i am not able to save the objekt to a binary file load them and use this data to initialize the Object with this data.
Its no problem write the state of Class to a binary file oder flatten the state to XML.
But i got a lot of troubles load them back.

I changed the example so that it works.
Please have a look.
Attachments:
saveclassdata.zip ‏37 KB

Similar Messages

  • Question : Save AWT Image Class to File..

    I Have a Question.. @.@a
    I'm doing AWT transform now..
    Well...
    I have a problem..
    I want to save AWT Image class to file..
    But.. I don't now that..
    Input Image Class same below..
    Image imageContent = (Image)attachment.getContent();
    How does it save imageContent Image class to file..?

    I had the same problem... convert it to a BufferedImage (http://forum.java.sun.com/thread.jspa?threadID=665744&tstart=15), then use javax.imageio.ImageIO.write to save it to a file.

  • This VI is part of a LabVIEW class. No part of the class is executable at this time because one of the member VIs is missing. However I am not missing a vi

    I only have 1 vi and its not missing.  The 1 vi claims the owning library has blocked the execution of the VI.  The class has the error "This VI is part of a LabVIEW class. No part of the class is executable at this time because one of the member VIs is missing. Find the missing member VIs on disk and load them into memory or delete them from the class definition in the project tree."
    But there is only 1 member vi!!??
    I had lots of other vi's as part of this class but somehow this class got botched with this error.  I removed all vi from the directory and from the class definition and re made just the one assessor vi and still got the error message.
    I have attached my ridiculously simple class.
    I have other classes that work fine but somehow this one seems to have gotten botched.  I really need to understand what happened here and how to recover/avoid this error or I will not have the confidence to develop large applications using classes.
    In other words...PLEASE HELP!
    Solved!
    Go to Solution.
    Attachments:
    Tree class.zip ‏14 KB

    I cannot tell you why.  Only what it is missing.
    If you look in the Tree.lvclass file using something like Notepad, towards the bottom you will see some XML that looks like:
    <Item Name="Untitled 1" Type="VI">
            <Property Name="NI.ClassItem.ConnectorPane" Type="Bin">#1#!!!!!!!)!"1!&amp;!!!-!%!!!@````]!!!!"!!%!!!$H!!!!#1!-1#%'=X2B&gt;(6T!!!,1!-!"'.P:'5!!""!-0````]'=W^V=G.F!!!71&amp;!!!Q!!!!%!!AFF=H*P=C"P&gt;81!"!!!!#*!=!!?!!!/$&amp;2S:75O&lt;(&lt;'&amp;T=Q!!#&amp;2S:75A&lt;X6U!!!A1&amp;!!!Q!!!!%!!B.F=H*P=C"J&lt;C!I&lt;G]A:8*S&lt;X)J!#"!=!!?!!!/$&amp;2S:75O&lt;(&lt;'&amp;T=Q!!"V2S:75A;7Y!0!$Q!!Q!!Q!%!!1!"1!%!!1!"!!%!!9!"!!%!!=#!!"Y$1A!!!!!D1M!!!!!!!!!!!A!!!!!!*!!!!!!!1!)!!!!!!</Property>
            <Property Name="NI.ClassItem.ExecutionSystem" Type="Int">-1</Property>
            <Property Name="NI.ClassItem.Flags" Type="Int">0</Property>
            <Property Name="NI.ClassItem.IsStaticMethod" Type="Bool">false</Property>
            <Property Name="NI.ClassItem.MethodScope" Type="UInt">1</Property>
            <Property Name="NI.ClassItem.Priority" Type="Int">1</Property>
            <Property Name="NI.ClassItem.State" Type="Int">1342841344</Property>
        </Item>
    Delete this block.  Make a backup of the file before you do that.  Start up LV and load the class again.
    My guess is that something probably did not save properly when LV shut down.  I have a large OO project and have had more than one occasion where I have corrupted the project but could ot figure out why. 
    Today I had a similar message which is why your post caught my eye.  In doing some troubleshooting I found that it no longer 'knew' where one of my files was but it never complained when it loaded the project.  I went back to the original project and tried to open that vi from the project.  That is when it told me that the vi was not in the expected location, do you want to correct it.  I said yes and all was better. 
    Trying to open all of the VIs in the class might have worked, but this can be cumbersome to say the least in a large class.
    Good luck,
    Kurt

  • Hi am trying to save Data into a write to measurement file vi using a NI PXI 1042Q with a real time mode but it is not working but when i run it with uploading it into the PXI it save in to the file

    Hi am trying to save Data into a write to measurement file vi using a NI PXI 1042Q and DAQ NI PXI-6229 with a real time mode but it is not working but when i run it without uploading it into the PXI it save in to the file please find attached my vi
    Attachments:
    PWMs.vi ‏130 KB

     other problem is that the channel DAQmx only works at real time mode not on stand alone vi using Labview 8.2 and Real time 8.2

  • How do I save a running sequence file

    Part of my testing requires a large number of variables to be passed to and from the UUT within TestStand. I can store some of these variables in the station globals, but I'd like the option to store others in the sequence files at run time and save them to disk (save the sequence file) at the end of the test. I can create variables in the station globals and commit the globals to disk just fine (LabVIEW vi's using the TestStand API). However, I cannot figure out how to do the same thing with a sequence file. My code is able to create and populate the locals variables with no problem, but I cannot save the running sequence file to disk with the new locals (or file globals) intact (they disappear when the sequence ends.) The reason I want to save the sequence file is to avoid manually entering all these variables into each sequence file locals list.
    So, I think the questions are:
    How do I make the new locals or file globals a part of the running sequence file?
    How do I save the sequence file to disk before it stops running?
    I can increment the change count on the file. I have figured out two or three ways to save the file while it's running without errors (although I doubt it's actually doing anything.) I'm using the TestStand API in LabVIEW vi's to pull this off and cannot find the functions I'm looking for.
    Sorry if this is rambling, it's kind of hard to describe.

    Hi Lars,
    The reason that we can't save the local variables created during
    runtime is because TestStand creates a runtime copy of the variables
    when the sequence starts. After the sequence is finished executing,
    this copy is discarded. The reason behind this is that TestStand allows
    for a single sequence to have multiple executions at the same time, and
    each instance gets its own runtime copy of the local variables. If new
    locals could be saved to the actual sequence file in memory, it could
    cause major problems for other execution threads of that particular
    .seq file.
    You can use the API to add variables to the actual file using
    GetSequenceFileEx and incrementing the Change Count, or create a
    separate sequence that modifies another sequence file, but adding these
    locals to the sequence file from itself isn't possible.
    Hope this helps Lars,
    Have a good one.
    Dan Weiland
    Applications Engineer
    National Instruments
    www.ni.com/support
    Dan Weiland

  • Can I save and read text files on a server that I host?

    Hello everyone,
    I am a java hobbiest. I was wondering if I set up my own server, running out of my house, could I have my applets save to my computer and read from my computer without having to learn JDBC and a DATABASE language. In other words could i just have my applet save and read text files from and to my server?
    I'm trying to set up a sight for my 5th grade class where parents can log into. Thanks for your time.
    Oh yeah, which is easier, learning how to set up a server or learning JDBC and a DATABASE language?
    If you have any other good idease please tell me them
    Thank you, Bryan

    Short answer: This isn't gonna work
    Long answer: For this to work, the first thing you're going to need is a static IP address and a DNS name registered -actually you don't necessarily need #2 but you're probably gonna want it and it's by far the easier of the steps.
    As far as I know to get a fixed IP address you've either gotta be directly attached to a larger network (ie university network) or get a leased line from an ISP.
    Once you've got that done come back to us.

  • Labview into excel file

    hello...i'm using labview 8.5 for my final year project..can i convert the graph in the labview into excel file by using this labview version? please...help me....ahaksss
    Solved!
    Go to Solution.

    If you just want the data, then this may be an option (I'm assuming this works in LV 8.5):
    Right click the graph, and select Export -> Export Data to Excel
    You need to have Excel on your computer to get this option.
    Other options:
    o Save your data to a file using Comma (or Tab) Delimited values - open file in Excel
    o Use Report Generator functions to create an Excel file
    steve
    Help the forum when you get help. Click the "Solution?" icon on the reply that answers your
    question. Give "Kudos" to replies that help.

  • Save NI report generator files with new names

    I was trying to save labview library files under new names so that I could adapt the code but the 'Save As' option is greyed out. In certain cases, when I try to copy and paste the code, I get broken wires and cannot get the VI's to work.
    I have been using the report generator toolkit which is quite limited. I was trying to delete a row from an spreasheet but there is no function to do this. So, one workaround that was suggested to me was to use the 'Excel Insert Cells' VI and change the code to instruct it to 'clear' cells rather than 'insert' them. This works, but I wanted to save a copy of the amended file under a different name so that it was independent of the installed library files but I can't seem to do this. I tried to copy out the code but got broken wires even though I have been able to do this in other instances.
    Any suggestions?
    Thanks,
    Will

    Hi Will,
    I had the same problem with a project and found the following workaround:
    To ensure the original function of any library VI, it's not recommended to just change the VI to do something else.
    Therefore I expanded the VI to do both, the original functionality and the special function I needed.
    I made an extra Input to the VI, which is a boolean Input.
    With that extra optional Input I can now choose the function I want to do.
    I made the "False" case to be default. This case works like the original function.
    The "True" case is built to do my special function.
    This workaround is quite easy and not dangerous. For all projects, which would use the function in their normal use case it's working just as if the file was unchanged.
    And for projects using special functionality I can add a "True" constant to my VI Input and the function works as I want..
    Hope this workaround helps to fix your problem!
    Kind regards
    adigator

  • Record a speech signal and save as a wav file?

    Dear All:
    I'd like to record a speech signal using one microphone and write/save as a .wav file. Can anyone help me on this issue.
    I'm using 6024E PCI NI-DAQ 7.0.
    Thank you
    regards,
    Jeffrey

    Jeffrey,
    Below is a link to a knowledge base that discusses the specifics in creating a .wav file and even includes an example of how to accomplish this with your daq board. Also, if you have a sound card, you can use the LabVIEW sound VI's to acquire a microphone signal through your sound card. Attached is the installer for the sound VI's for LabVIEW.
    Wave File Creation
    Attachments:
    Sound_VIs_Installer_-_Win32.zip ‏2130 KB

  • Save byte[] to a file

    Hi,
    I have a byte[] and I am trying to save it to a file.....such as a tar.gz or .zip file..... how would I do that?
    I have taken the byte[] and made a string, and then saved it ...but i think this would be different right?
    thanks.

    public static InputStream getInputStream(String tarFileName) throws Exception{
          if(tarFileName.substring(tarFileName.lastIndexOf(".") + 1, tarFileName.lastIndexOf(".") + 3).equalsIgnoreCase("gz")){
             System.out.println("Creating an GZIPInputStream for the file");
             return new GZIPInputStream(new FileInputStream(new File(tarFileName)));
          }else{
             System.out.println("Creating an InputStream for the file");
             return new FileInputStream(new File(tarFileName));
       public static void readTar(InputStream in, String untarDir) throws IOException{
          System.out.println("Reading TarInputStream... (using classes from http://www.trustice.com/java/tar/)");
          TarInputStream tin = new TarInputStream(in);
          TarEntry tarEntry = tin.getNextEntry();
          if(new File(untarDir).exists()){
               while (tarEntry != null){
                  File destPath = new File(untarDir + File.separatorChar + tarEntry.getName());
                  System.out.println("Processing " + destPath.getAbsoluteFile());
                  if(!tarEntry.isDirectory()){
                     FileOutputStream fout = new FileOutputStream(destPath);
                     tin.copyEntryContents(fout);
                     fout.close();
                  }else{
                     destPath.mkdir();
                  tarEntry = tin.getNextEntry();
               tin.close();
          }else{
             System.out.println("That destination directory doesn't exist! " + untarDir);
       }

  • Using Requirements Gateway with LabVIEW classes

    Does anyone know how to get the NI Requirements Gateway to read coverage information from the documentation contained in a LabVIEW class (.lvclass)?
    Requirements Gateway appears to load the documentation content fine from VIs, controls, .llb, .lvlib, .lvproj etc, but not .lvclass? My LabVIEW keeps crashing out when I try to point Requirements Gateway at a project with .lvclass files!
    If this can't be done then is there a neat way to add requirements coverage information (you know, the "Covers: ID" field) into the class properties, or something near the class maybe, that Requirements Gateway can read?
    Thoric (CLA, CLED, CTD and LabVIEW Champion)
    Solved!
    Go to Solution.

    Hi Manooch,
    Thank you for your prompt reply. The example you attached, with a little alteration to include the coverage ID tag in the class documentation field, does precisely what I need, thank you. The snapshot below shows the LabVIEW class satisfying requirement 2:
    However, this doesn't work in my project. I have similar content, and when I ask Requirements Gateway to analyse the project it shows nothing and then LabVIEW crashes! I'll have to try stripping my project down to the bare bones to find the problematic element. I hate it when this happens....
    Thoric (CLA, CLED, CTD and LabVIEW Champion)

  • Save to series of file

    Sto utilizzando Write to measurement file e ho scelto l'opzione save to series of file (data + ora). Ciò nonostante, il programma, sviluppato con Labview Basic 2009, salva su un solo file test.lvm. Se fermo l'esecuzione e riapro la finestra delle proprietà del write to measurement file, l'opzione selezionata è in effetti save to one file.
    Per quanto io riselezioni l'altra opzione e clicchi su ok, il programma salava su un solo file. Potete darmi qualche suggerimento? grazie

    DavideB wrote:
    I'm using Write to Measurement File and I chose the option to save series of files (date + hour). Nevertheless, the program developed with Labview Basic 2009, save on one file test.lvm. If you stop the execution and reopen the properties window write to measurement file, the selected option is in effect save to one file.
    As I re-select the other option and click OK, the program salted on a single file. Do you have any suggestions? thanks
    Non ho una risposta, ma io vedo lo stesso comportamento. Sono riuscito a salvare uno in LV8.6, aprire / salvare nuovamente nel 2009 e visualizzare le funzionalità che ci si aspetta.
    I don't have an answer, but I do see the same behavior.  I was able to save one in LV8.6, open/resave it in 2009 and see the functionality you expect.
    Jim
    You're entirely bonkers. But I'll tell you a secret. All the best people are. ~ Alice
    Attachments:
    W2MF_2009.vi ‏40 KB

  • Save image to a file got a blank image.

    I need to save graphics image of a component to a file. Following is what I did.
    1. Call createImage() from this component.
    2. Convert the image to a BufferedImage.
    3. Call ImageIO.write() to save it in a file.
    What I got from the result file is all blank. Following is the code.
    Please help. Thanks a lot!
    import java.io.*;
    import java.awt.*;
    import java.awt.image.*;
    import javax.imageio.*;
    import javax.swing.*;
    public class SaveLabelImage
         String jpg_out = "image.jpg";
         String dir_name = "c:\\temp\\";
         SaveLabelImage()
              // Use a label to display some text
              JFrame frame = new JFrame();
              JLabel label = new JLabel( "ABCDEFG", JLabel.CENTER );
              Container contentPane = frame.getContentPane();
              contentPane.add( label, BorderLayout.CENTER );
              frame.setSize( 300, 150 );
              frame.setVisible(true);
              File f_dir = new File( dir_name );
              if ( !f_dir.exists() ) f_dir.mkdir();          
              write_label( label, jpg_out );
    public void write_label( JLabel label, String out_fn )
              // Save the image to a file
              int w = label.getWidth();
              int h = label.getHeight();
              Image im = (Image)label.createImage( w, h );
              BufferedImage bimage = new BufferedImage( w, h, BufferedImage.TYPE_INT_RGB );     
              Graphics2D g2 = bimage.createGraphics();     
              g2.drawImage( im, null, null );                                             
              if ( bimage == null ) {
                   System.out.println( "Buffered Image is null!" );
                   return;
              try
                   String fn = dir_name + jpg_out;
                   File file = new File( fn );
    ImageIO.write( bimage, "jpg", file );          
                   System.out.println( "Image of Jlabel is saved in file " + fn );
              catch (IOException e) {;    }
         }     //write_label
         public static void main(String arg[])
              new SaveLabelImage() ;               
    }     // class SaveLabelImage

    I am able to get a good image file now. Thanks you very much.
    However I still have a few quesions.
    1. In my case, the label is visible on the screen, why I need to call the setVisible(true) again?
    2. Why use print() instead of paint()?
    3. I have to use BufferedImage.TYPE_INT_ARGB to create a new BufferedImage, otherwise the result image file is in black.
    4. I did not use the hints because it is very confusing. Fortunately, It worked without them.
    Following is a modified version of your code.
    import java.io.*;
    import java.awt.*;
    import java.util.*;
    import java.awt.image.*;
    import javax.imageio.*;
    import javax.swing.*;
    public class SaveComponentAsImage
    public static void saveComponentAsImage(
                             JComponent c,
                             int w, int h, int image_type,
                             String fn, String file_type )
              c.setSize(w, h);
    c.setVisible(true);
    c.validate();
    // use TYPE_INT_ARGB if you want alpha (transparency)
    BufferedImage image = new BufferedImage( w, h, image_type );
    Graphics g = image.getGraphics();
    // draw the graphics
    c.print(g);
    g.drawLine(0,0, c.getWidth(),c.getHeight());
    // write it out
    try {
    ImageIO.write(image, file_type, new File(fn));
    System.out.println( "Image is saved in file " + fn );
    } catch (IOException ioe) {
    System.out.println(ioe.getMessage());
    // cleanup
    g.dispose();
         public static void main(String arg[])
              JLabel l = new JLabel( "ABCDEFG", JLabel.CENTER );
              int w = l.getWidth();
              int h = l.getHeight();
              System.out.println( "label width=" + w );
              System.out.println( "label height=" + h );
              if ( w == 0 || h == 0 )
                   w = l.getPreferredSize().width;
                   h = l.getPreferredSize().height;
              System.out.println( "Preffered width=" + w );
              System.out.println( "Preffered height=" + h );          
              w +=100;
              h +=50;          
              String fn = "myImage.png";
              int image_type = BufferedImage.TYPE_INT_RGB;          
              saveComponentAsImage( (JComponent)l, w, h, image_type, fn, "png" ) ;     
              image_type = BufferedImage.TYPE_INT_ARGB;     
              fn = "myImage_ARGB.png";                                   
              saveComponentAsImage( (JComponent)l, w, h, image_type, fn, "png" ) ;     
    }

  • I need to capture streaming audio and save to a wav file

    I need to be able to capture an audio stream delivered via ethernet using UDP protocol and then save to a wav file.
    I currently can capture the data stream but do not know how to format the data to save it to a file. Our format is 16KS/s, 16bit, PCM, no compression.

    Did you do the thing about searching in the example database. Let us use that as base for discussion. Those who put in some effort will be rewarded. Also check out the AU file format http://en.wikipedia.org/wiki/Au_file_format As it is big-endian http://en.wikipedia.org/wiki/Big-endian the numbers can be stored as is in Labview. Must players,matlab, etc can use the AU file format.
    Besides which, my opinion is that Express VIs Carthage must be destroyed deleted
    (Sorry no Labview "brag list" so far)

  • Auto Save to Spread Sheet file every N samples

    I am in the need for a way to automatically save data to a file for every N-samples that are acquired.  I've written the attatched reentrant subVI, but there are some problems.  Whenever I have it in my program loop it hogs the process (stalling data acquisition) and just writes the initial values a bunch of times (the file quickly goes into the 10's of megs).  I don't know where I'm going wrong in my algorithm.
    Here is the algorithm I'm trying to realize with this subvi.
    Inputs:
    1. 1 x M array
    2. number of samples to record at a time (N)
    3. path to folder to automatically save files
    Algorithm:
    Initial run:
    1. Create file name based on current date/time and folder path input.
    2. Initialize an array that is N x M (so the number of rows is the number of samples to record, by the number of columns coming from the input).
    3. Place the first row of input data into the first column of the array.
    Subsequent runs:
    1. Place the input data into the next position of the N x M array
    2. If and only if current_input_count % N == (N - 1) then save the data to the autosave file.  (note: %=modulus operator)
    My typical sample rate is around 2-5 samples per second.  I need this because some of our tests are really long (like hours long), and if the DAQ computer fails to save the final data set then we pretty much lost the entire test.
    Sorry my G code is so sloppy.  Thank you for any input.  I'm targetting LabVIEW 8.
    -Nickerbocker
    Attachments:
    Auto Save N Points.vi ‏22 KB

    For "automatically saving the data to a file for every N-samples that are acquired", you might have to use LabVIEW measurement file for storing your samples. Also, I have slightly modified your code. Double click on the LabVIEW Measurement file and then check different options available to store your samples. Hope this helps.
    PS: Assuming that this is the only probelm you have, I didn't go through your algorithm.
    Attachments:
    Auto Save N Points.zip ‏51 KB

Maybe you are looking for

  • Understanding Weblogic Integration 9.2

    Hi All, I am very new to Weblogic Integration and we were asked to make our application use WLI. Our application has many source feeds and we also interface with SAP with Web Services calls. I am totally new to Weblogic Integration and I would apprec

  • Finder not reporting correct disk usage

    Just installed Leopard on a MP 15'' and finder report my 120g disk has only 50g free. When I use WhatSize app it report only 32G as being used. I checked the drive for damage, and disk utils reported none. Before the install Tiger Finder was reportin

  • Missing old music and audiobooks, help?!?!

    After I downloaded my three new audiobooks onto my ipod nano, all of my old books and music disappeared.  How do I get everything back?

  • CS4 Photoshop How do I reverse a clipping path.

    I made a clipping path and accidently clipped the outside of the bottle instead of the bottle. How do I reverse the clipping path? I know there is some icon that is supposed to show up on the top control bar but I am not finding anything. Thank you.

  • Remove SNMP trap receiver in CatOS

    I've done the Cisco search and came up empty. I used to know this. Isn't there a hidden remove command? Version is CatOs 8.4.1. Hopefully one of you can save the day. TIA!