Saving text file at different rate

Hello all,
I am a little bit new to LabView, so maybe this question is trivial, but is giving me a lot of pain.
I want to continuously save a given string at two different rates; in the example provided these rates are at every 500 ms and 50 ms, in two different text files (one for each rate). I tried to use while structured loops for this purpose. When I use only one, it works fine, but when I use both of them at the same time, it seems Labview limits both paths to the lowest speed, which in this case is obviously 500 ms, and eventually I obtain two exact files with the string saved at 500 ms period.
How can I make it work?
Thanks in advance.

You still have ways to go for a more reasonable code.
For example, typically you want to open the files before the loop, keep appending inside the loops, and close the files after the loop, when the program stops. Now you don't even need to set the file position inside the loops because it will automatically keep writing right after the previous write position. This is much more efficient than to open and close the file with each iteration.
 

Similar Messages

  • Scenario or adapter to sending a text file to different target directories

    Hi experts
    In XI 3.0 I have developed a file2file scenario that takes a comma-separated file (*.csv) and converts it and returns a text file that is sent to a specific directory, the name input file determines the Target Directory, for each input file there is a sender channel and receiver channel that put the output file in the Target Directory. The problem is that i have many channels and not know how to make only one sender channel which takes the input file and the receiver channel to sends the output file to the destination directory through the file name. e.g. VTAS03.csv file located in target directory //work becomes in Clients.txt file in the directory //sap03 ie //work/VTAS03.csv --> //sap03/Clients.txt while the file VTAS05.csv must go to the directory //sap05 i.e. //work/VTAS05.csv --> //sap05/Clients.txt, //work/VTAS07.csv --> //sap07/Clients.txt so on.
    In short the output file name is the same for all but must go to different directories according to the input file name without using as many channels of communication.
    Someone can help me or tell me how to do this?
    Thanks  

    Liz,
    Please use the below steps if you are considering of using mapping program.
    Select the check boxes for the following Adapter Specific Message attributes in
    Sender Channel - FILE
    Receiver Channel - DIRECTORY
    Put the file name as Clients.txt in receiver channel , and directory name can be anything like TEST
    DynamicConfiguration conf = (DynamicConfiguration) container
        .getTransformationParameters()
        .get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
    DynamicConfigurationKey key = DynamicConfigurationKey.create(
        "http://sap.com/xi/XI/System/File",
        "Directory");
    DynamicConfigurationKey key1 = DynamicConfigurationKey.create(
        "http://sap.com/xi/XI/System/File",
        "FileName");
    String temp = conf.get(key1);
    String src_filname = temp.substring(4,5) //This is used to get the last two digit value from the file name
    String tar_dir = "//sap"+src_filename+"/";
    conf.put(key,tar_dir);
    return "";
    I hope the above suggestion solves your problem!
    Thanks!

  • Is SAP capable of sending a TEXT file in different modes like DOS ?

    Is SAP capable of sending a TEXT file (.txt)  in different modes like DOS ?

    Yes SAP is capable to send .txt file in different mode.
    For this you have to maintain the setting of Code page and encoding. There so may types of encoding (UTF-8, UTF-8 without BOM, UTF-16 etc) supported by SAP. You can check them from SAP logon pad.
    If you are creating the file on application server then you can also mentioned encoding statement in OPEN DATASET statements.
    For more details check open dataset statement.

  • Write arrays into a text file in different columns at different times

    Hi,
              I have a problem write data into a text file. I want to write 4 1D arrays into a text file. The problem is that I need to write it at different time and in different column (in other word, not only append the arrays).
    Do you have an idea to solve my problem?
    Thank you

    A file is long a linear string of data (text). In order ro insert columns, you need to rewrite the entire file, because colums are interlaced over the entire lenght of the file.
    So:
    read file into 2D array
    insert columns using array operations
    write resulting 2D array to file again.
    (Only if your colums are guaranteed to be fixed width AND you know the final number of colums, you could write the missing columns as spaces and then overwrite later. Still, it will be painful and inefficient, because column data are not adjacent in the file.)
    LabVIEW Champion . Do more with less code and in less time .

  • How do I prevent sharing a text file by different users

    Hello,
    I am using LV8.6.1 and writing this application that read and write to a text file. The application is being used by many users at different sites and I want to prevent writing to the text file when other user is already using it (reading or writing to it). The other user should only be able to use it when it's not being read or getting written.
    Any suggestions? I know LV file function 'Set Permissions' won't work. I need a file attribute that tells that the file is open, so don't use it.

    I think the only real obtion is one I've seen some other programs use.
    Create a lock file in the same directory.
    1.  You want to open myfile.txt.
    2.  Your program looks to see if myfile.lck is present.  (Same filename, just the extension is different)
    3.  If it is present, you don't open the file or you give a warning.
    4.  If it is not present, you create a myfile.lck file.  It could be a small text file.  Perhaps you place in it the user name of the person who is opening the file.
    5.  When your VI is done with the file and "closes" it, your VI deletes the myfile.lck file.
    So the presence of the myfile.lck file indicates the file is being used.
    The absence of the myfile.lck indicates the file is available to be used.
    The only risk is if somehow the person who "takes out" the file somehow ends their application unexpectedly and the .lck file doesn't get deleted even though they are done.  You would need to manually go in and delete the .lck file.  But username data in the .lck could help determine who had the file last and you could confirm if they are really using it or not.  Putting the filedate in the warning information would help determine if it was a recent lock, or an old lock that is likely stale.

  • Load Multiple Dynamic Text Files in Different frames on Maintimeline

    Hello!
    I have managed to load an external text file in one place one the maintimeline. I would like to do the same thing on other frames. When I go to duplicate the same thing that I did on the first one I get a duplicate textReq request. Do I need to give the textReq a more specific name for each section? When I did this the movie wouldn't even recognize and of the code that was working before.
    Can anyone help me with this code? Thanks in advance
    I am attaching link so you can see sections I am talking about. Also you will notice that the swf file I loaded won't go away. That's another problem...ugh.
    Here is link:
    http://www.sandraschmitt.com/coclico/index100.html
    Here is code on maintimeline:
    stop();
    import fl.transitions.*;
    import fl.transitions.easing.*;
    import flash.net.URLRequest;
    import flash.display.Loader;
    import flash.events.Event;
    import flash.events.ProgressEvent;
    function startLoad() {
        var swfLoader:Loader = new Loader();
        var swfRequest:URLRequest = new URLRequest("endlessCoclico3.swf");
        swfLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, onCompleteHandler);
        swfLoader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, onProgressHandler);
        swfLoader.load(swfRequest);
    function onCompleteHandler(loadEvent:Event) {
        addChild(loadEvent.currentTarget.content);
    function onProgressHandler(swfProgress:ProgressEvent) {
        var percent:Number = swfProgress.bytesLoaded/swfProgress.bytesTotal;
        trace(percent);
    startLoad();
    //handle events for buttons...
    collections.addEventListener(MouseEvent.CLICK, clickSection);
    raison.addEventListener(MouseEvent.CLICK, clickSection);
    stores.addEventListener(MouseEvent.CLICK, clickSection);
    news.addEventListener(MouseEvent.CLICK, clickSection);
    contact.addEventListener(MouseEvent.CLICK, clickSection);
    home.addEventListener(MouseEvent.CLICK, clickSection);
    function clickSection(evtObj:MouseEvent) {
        //trace shows what's happening... in the output window
        trace("The "+evtObj.target.name+" button was clicked!");
        //go to the section clicked on...
        gotoAndStop(evtObj.target.name);
    Here is code on actual frame where the dynamic text is working:
    //Loaded exteranl text fields
    var textLoader:URLLoader = new URLLoader();
    var textReq:URLRequest = new URLRequest("text_philosophy.txt");
    function textLoaded(event:Event):void {
        philosophy_txt.text = textLoader.data;
    textLoader.load(textReq);
    textLoader.addEventListener(Event.COMPLETE, textLoaded);

    Textfields:  What I like to do, mainly for peace of mind, is to have a layer that I dedicate to actionscript that only has code in frame 1 but it extends the full length of the timeline so that this code is available to every frame on any other layer.  In this frame I put variables and functions that can get used/shared wherever they happen to be needed.  I usually create another separate layer for actions types of actionscript... stuff that happens at the local frame level, like stop();, or like assigning a variable a new value, etc... things local to being at that frame/location.  So with that in mind
    In frame 1 on my shared-by-everyone layer, I'd probably declare the variable....
    var textReq:URLRequest;
    And when I get to a particular frame where I want to load a new textfield with data, I assign that var its value on the local actions layer...
    textReq = new URLRequest("text_philosophy.txt");
    along with the rest of the local execution regarding loading the file, etc...
    SWF's:
    Yeah, pretty much, and it becomes an object that has a home on the timeline, so if you move away from that frame the swf doesn't follow.

  • Are plain text files treated differently in SP 2010 than MOSS 2007?

    We just moved to SP 2010 a week ago.  A user just contacted us asking why the files she accesses are not displaying.
    When she accessed these plain text files in MOSS 2007, they displayed within IE as a full page of text.
    When she accesses these now in SP 2010, she is prompted to download the file.
    These files do not end in .txt - they are names such as 2013.09.20 or whatever.
    Is there a way to configure 2010 to display, without any interpretation, plain text files within the browser?
    Thank you.

    Hi ,
    According to your description, my understanding is that you could not access the txt files with browser after migrading to SharePoint 2010..
    Whether this issue occurred if you upload a new txt file to a library.
    In my testing, everything worked well. The Open Documents in Client Applications by Default feature was acitve, and in the Library Settings->Advanced settings, ‘Use the server default(Open in the client application)’ was selected. When I clicked the file
    name, it promted a dialog like the below, I selected ‘Read-Only’, and clicked OK, the file could open with browser.
    Please go to IE->Tools->Internet Options->Programs->Manage add-ons, enable all add-ons related to SharePoint, compare the result.
    I hope this helps.
    Thanks,
    Wendy
    Wendy Li
    TechNet Community Support

  • Modify text file by different user?

    My AIR Application create one text file under Administrator. but guest user cannot modify that text file.The code is below
    var file:File = new File("file:///D:/BALA /test.txt ");
    var str = String(Math.round(Math.random()*9)+1);
    var fileStream:FileStream = new FileStream();
    fileStream.openAsync(file, FileMode.WRITE);
    fileStream.writeUTFBytes(str);
    fileStream.close();
    Can any one solve this issue?
    Thanks
    Regards
    Balasubramaniyan.S

    The AIR app has the OS rights of the user account used to run the app.

  • How to insert text from saved text file using line number to indesign document to specific cursor point?

    i'm using indesign for make books. always i need insert quotes from some holy books. so i need to insert text using verse number

    i'm not asking about
    b
    u
    l
    l
    e
    t and
    n
    u
    m
    b
    e
    r
    i
    n
    g
    sorry for my bad english
    my target is simply insert pre typed sorted texts using the verse number. for example. i have Holy Quran full text . it have about 6000 verse. suppose i need chapter 3, verse 5 in to my paragraph. manually i goto that text file and copy the text paste it here. but i need it automatically using page number/ verse number/ unique id. script / addins .
    approximately like "data merge " in design.

  • Reading text file in different encodings

    I am trying to build a tool that will display XML files. As some of these files are generated from a stylesheet transform they may have an encoding other than ascii (for example, UTF-8 or UTF-16). The Java InputStreamReader will accept an encoding type but I don't know how to determine what the file is encoded in. I have some code that examines the first byte of the file to make this determination but I am sure there is a better way.
    If I do have to look at the start of the file is there a definitive mapping of encoding to binary representation?
    Thanks.

    Hi Lakshman,
    1.Files in application server are called 'Sequential files'. they are also called as 'Dataset'.
    2.To handle sequential file we can follow the below said procedures.
       a.  To open sequentioal file:
              OPEN DATASET <FILENAME> FOR { OUTPUT/INPUT/APPENDING}
              IN {TEXT MODE/BINARY MODE}
       b. To process ( reading/writing):
           TRANSFER <FIELD> TO <FILE NAME>,
           READ DATASET <FILENAME> INTO <FIELD>.
      c.  To close:
            CLOSE DATASET <FILENAME>
    3. To see  the application files tcode: AL11
    4. Download the files from application server to presentation server : CG3Y
    5. Presentation server to application server : CG3Z
    Regards,
    Sakthivel.VT

  • Reading a text file with different delimiters using Scanner

    Hello,
    I'm trying to read text from a file using ", " as a delimiter between Strings using a Scanner. I tried reading one line and then using the split() method in the string class, split each string by it's delimiter. I tried using an ArrayList to store each split token and the compiler is giving me some sort of syntax error when I'm pretty sure its right. If help can be given, it would be greatly appreciated. Thank you
    Here's my code
    Scanner input = new Scanner(backupFile);
    input.useDelimiter("[, ]");
    while (input.hasNext()) {
    ArrayList<String> list = new ArrayList<String>();
    String s = input.nextLine();
    String delims = "[, ]";
    list.add(s.split(delims));
    for(int i = 0; i < list.size(); i++)
    System.out.println(list.get(i));
    list.clear();
    }

    s.split(delims) will return an array of strings, not a string. So you need to declare list as an array list of such arrays:ArrayList<String[]> list = new ArrayList<String[]>();(It's a good idea to copy and post compiler messages here, so no-one has to guess. Likewise indicate which line of your code they are referring to.)
    [Edit]If it only the contents of the array you wish to put in the array, then you can just say List list = Arrays.asList(s.split(delims));

  • Saving text files in cell phone

    hi i already know a little bit of JSE and some of JEE, now i need to know JME, first i need to create a movil application, that application need to save files in my cell phone in the memory stick or cell memory in order to send that file like photos to my pc , the application is a kind of list, you create a list then you save the list in a XML file in the phone, then i must be capable to use that file as any other file in the phone, like photos because i have to send it with bluetooth, the application will read too XML files pleasseeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee helppp me just give me some examples or classes or any page to read any tutorial or something to start reading, i already found information about creating forms but not about files

    Good tutorial to look out for based on your requirement
    http://forum.nokia.com/info/sw.nokia.com/id/de0f933c-0bd3-4143-b62a-ab867a43409a/MIDP_FileConnection_API_Developers_Guide_v2_0_en.zip.html
    ~Mohan

  • Two machines saving the same file as different sizes?

    My coworker and I both have the same version of Illustratir (CS6) and both use Lion on iMacs, but today noticed something weird. He saved a file similar to a file I had done before as both an eps and a pdf and his file size was more than twice what my file sizes usually are. I thought it was odd, so I copied everything from his file into a new file (same dimensions) and saved out an eps and pdf (default settings), and like I thought, my files were less than half the size of his.
    Why would two machines be saving identical files at different sizes? Is there a setting somewhere I'm missing? Everything in the file is vector, if it matters. There's not even any editable text.

    See the mechanism of saving here: http://superuser.com/questions/66825/what-is-the-difference-between-size-and-size-on-disk
    The size of the "blocks" depends on the size of the disk and how it's been formatted.

  • How do I send a text file from one device to another?

    Hi,
    I'm working on an Android Air app made in CS5.5 where user data is saved in the app's applicationStorageDirectory as a text file.
    Is there a way to send this saved text file to another device's applicationStorageDirectory via Bluetooth/email/text e.g?
    The idea is that the app "game" is saved on each person's device. When the game is over, I want the users to be able to compare their results. (I'll write some code to compute who the winner is via comparing the two results)
    Any help is greatly appreciated. Some code sample would be terriffic.
    Thanks,
    J.D.

    You're in native extension territory. Access to things like bluetooth are well beyond the scope of the AIR framework. You'd need to write a native extension, which is code that taps into the native functionality of the device to expand flash's abilities, to use something like bluetooth.
    For you to share locally it most likely may need you to use push notifications, which are perfectly possible, even on wifi.

  • Extra space adding during spool data into text file

    I'm using sql developer to query oracle tables. I can export data using GUI of sql developer, but I wish to use spool query to export the data. Using below query, I was able to export the data to specified location, but my final text file consist of additional spaces after each line. These additional spaces between each line is causing an error to upload the text file in different location.
    Did any one face have this issue? Below is my query
    set head off
    SET FEEDBACK OFF
    SET ECHO    OFF
    SET TRIMSPOOL ON
    SET TRIMOUT ON
    spool c:\test.txt
    select cast(memberid||',12'as varchar2(20))
    from abc;
    spool off
    set head on
    set ECHO on
    i'm using trimspool, and trimout, but it is not removing any blank spaces.

    Sorry, I changed my export.sql to the query you provided.
    SET HEAD OFF FEED OFF ECHO OFF
    SET LIN 120 PAGES 0 TRIMS ON
    SPOOL c:\test.txt
    SELECT memberid || ',12' FROM abc;
    SPOOL OFF
    But,the spool query is still adding additional spaces making length of each line 43 characters in final text file output.

Maybe you are looking for