Write to measurement file - Create or replace with confirmation
I'm using the "Write to measurement file.vi" and I want it to ask for confirmation if I try to save with a filename that already exists and then allow me to choose another file name or overwrite the old one. How can I do this?
Solved!
Go to Solution.
smercurio_fc wrote:
Ben wrote:
smercurio_fc wrote:
That Express VI does not have the capability you are seeking. ...
Help us Obe Wan, you're our only hope.
Ben
Did I misunderstand the question again?
No.
Spoiler (Highlight to read)
Your wording reminded me of the scene from Star Wars when Ben Kanobe di dthe force thing on the strorm troopers telling them "These are not the droid you seek."
Your wording reminded me of the scene from Star Wars when Ben Kanobe di dthe force thing on the strorm troopers telling them "These are not the droid you seek."
Its just Friday.
Ben
Ben Rayner
I am currently active on.. MainStream Preppers
Rayner's Ridge is under construction
Similar Messages
-
I'm using the Express Write to LabVIEW Measurement File in LV7.1.
I have it set to "Save to one file" and have tried both "Overwrite file" and "Using next available file name" for the "If a file already exists" conditions.
The path/filename is passed into the function.
It works fine the first time around. If the file is deleted before the function is called again, an error occurs since LV is unable to find the file.
I have had to stop and re-run my program in order to write to use the function again.
Since I am able to delete the file I assume it was closed but it seems like LV expects it to be there, even though the function was supposed to create/open/close the file... Is there any way to reset this without stopping/restarting the program?
Since my application creates several files (only one using the Express VI) I am checking for the filenames and requiring that they be deleted (or a new filename be used) before acquiring data. Everything has worked great, except for the Express VI.
Thank you,
DavidOk, I've edited the VI you posted to reproduce my error (this time with 8.0).
I added a "master stop" and "start log" button. To demonstrate my problem:
1. Run the VI
2. Click "START LOGGING" - c:\test.txt is created
3. Click "STOP" - c:\test.txt is closed
4. Delete the file c:\test.txt with Windows shell or explorer
5. Click "START LGGING" - a new c:\test.txt file should be created but instead an error is raised in the Write LabVIEW Measurement File function.
Any ideas?
Thanks,
Dave
Attachments:
Write LV Meas File 2.vi 96 KB -
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 KBother 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
-
Quickie: Write to measurement file VI, how to create new file?
I am using the write to measurement file express VI in my code and I have wired into it a control that sets the location to save the measurement file
The only problem is the measurement file has to exist first!! I cant for example, from the front panel, click the browse directory box, navigate to a folder and type in a name for the file. It just says file not found! Its like the file directory control is opening a file to save to, rather than creating a new file in that location
How can I solve this?
Solved!
Go to Solution.Project attached
If I go in browse options what do i do? Just chose new and existing files?
Attachments:
engine.zip 119 KB -
Help with saving time stamps to "write to measurement file" excel format.
I am having problems saving the timestamps from my data to the write to measurement express vi for excel. My incoming data is converted from dynamic data to a 1d array for processing, which I understand you lose the time stamp data. I added a new array for time stamps but this array then cannot be converted back to the dynamic data that is requested to go into the write to measurement file express vi. I would prefer to leave the data in an array to be saved rather than converting it to a waveform so is there any way to add the time stamps from my 1d array back into the write to measurement file?
I set it up to build a waveform now but I am still having issues with it saving the correct timestamp. The time just incriments for every second (as it did before converting the dynamic data to the waveform). I attached a screenshot.
Attachments:
waveform.png 36 KB -
Time with 'Write to measurement file'
Hello,
I am making an acquisition waveform. The integration time is 1s divided in 128 samples. When I execute the software, the datas are stored in a text file with 'Write to measurement file'. This text file is a continuous list of 128 numbers-packs in rows.
I want to add the time column (date+hour+minutes+secondes+1/10sec+1/100sec) in front of each number acquired. (And not only in front of the first number of the 128 package)
I have don t know how to add this.
Can you help me?
Thanks a lot.
(See file attached)
Attachments:
test3.vi 148 KBAlso, in the setup dialog for the Write Measurement File, there's an option to include an "X Column Value" that normally holds a timestamp.
Enable one of these options and any included timestamp in your waveform will go into this column. If you don't have a waveform, you can build an extra column in your array of data points with the needed timestamp and it will work the same.
Ed
Message Edited by Ed Dickens on 02-20-2007 03:37 PM
Ed Dickens - Certified LabVIEW Architect - DISTek Integration, Inc. - NI Certified Alliance Partner
Using the Abort button to stop your VI is like using a tree to stop your car. It works, but there may be consequences.
Attachments:
WLVMF Time Column.gif 9 KB -
Samples number is not properly set with VI Express Write To Measurement File
Hello,
I have a strange problem with the VI Express Write To Measurement File.
When I generate the .lvm file the samples number for each channel is equal to 1
instead of 34 !
So when I use the VI Express / Input / Generate an arbitrary signal and I want to import
the generated signal... only one point (the first one) is imported...
I can manualy fix it by changing samples number in the lvm file using a text editor but that's a (very) dirty hack !
Here is an example of the generated LVM file
LabVIEW Measurement
Writer_Version 0.92
Reader_Version 1
Separator Tab
Multi_Headings No
X_Columns One
Time_Pref Absolute
Operator scls
Date 2008/04/12
Time 10:35:58,322057
***End_of_Header***
Channels 2
Samples 1 1
Date 2008/04/12 2008/04/12
Time 10:35:58,323057 10:35:58,323057
X_Dimension Time Time
X0 0.0000000000000000E+0 0.0000000000000000E+0
Delta_X 1.000000 1.000000
***End_of_Header***
X_Value Untitled Untitled 1 Comment
0.000000 0.000000 20.000000
0.082000 10.000000 20.000000
0.182000 10.000000 25.000000
0.282000 20.000000 25.000000
0.382000 20.000000 30.000000
0.482000 30.000000 30.000000
0.582000 30.000000 35.000000
0.682000 40.000000 35.000000
0.782000 40.000000 40.000000
0.882000 50.000000 40.000000
0.982000 50.000000 45.000000
1.082000 60.000000 45.000000
1.182000 60.000000 50.000000
1.282000 70.000000 50.000000
1.382000 70.000000 55.000000
1.482000 80.000000 55.000000
1.582000 80.000000 60.000000
1.682000 90.000000 60.000000
1.782000 90.000000 65.000000
1.882000 100.000000 65.000000
1.982000 100.000000 70.000000
2.082000 110.000000 70.000000
2.182000 110.000000 75.000000
2.282000 120.000000 75.000000
2.382000 120.000000 80.000000
2.482000 130.000000 80.000000
2.582000 130.000000 85.000000
2.682000 140.000000 85.000000
2.782000 140.000000 90.000000
2.882000 150.000000 90.000000
2.982000 150.000000 95.000000
3.082000 160.000000 95.000000
3.182000 160.000000 100.000000
3.282000 170.000000 100.000000
PS : I also post my problem at
http://forums.lavag.org/Strange-behaviour-of-VI-Express-Write-LVM-t10570.html&gopid=44101#entry44101
Attachments:
generate_step_lvm.vi 119 KBIf I use the "one header per segment" option I get the following LVM file (see below)
But the problem is same !
I can't import this file in VI Express / Input / Generate Abitrary Signal (I only get one row... the first one)
I see three solutions :
- VI Express Write LVM has a bug ?
- I don't know how to use this VI Express correctly !
- VI Express / Input / Generate Abitrary Signal has a bug ?
LabVIEW Measurement
Writer_Version 0.92
Reader_Version 1
Separator Tab
Multi_Headings Yes
X_Columns One
Time_Pref Absolute
Operator scls
Date 2008/04/12
Time 16:38:37,578
***End_of_Header***
Channels 2
Samples 1 1
Date 2008/04/12 2008/04/12
Time 16:38:37,592999 16:38:37,592999
X_Dimension Time Time
X0 0.0000000000000000E+0 0.0000000000000000E+0
Delta_X 1.000000 1.000000
***End_of_Header***
X_Value Untitled Untitled 1 Comment
0.000000 0.000000 20.000000
Channels 2
Samples 1 1
Date 2008/04/12 2008/04/12
Time 16:38:37,717 16:38:37,717
X_Dimension Time Time
X0 1.3899993896484375E-1 1.3899993896484375E-1
Delta_X 1.000000 1.000000
***End_of_Header***
X_Value Untitled Untitled 1 Comment
0.139000 10.000000 20.000000
Channels 2
Samples 1 1
Date 2008/04/12 2008/04/12
Time 16:38:37,739999 16:38:37,739999
X_Dimension Time Time
X0 1.6199970245361328E-1 1.6199970245361328E-1
Delta_X 1.000000 1.000000
***End_of_Header***
X_Value Untitled Untitled 1 Comment
0.162000 10.000000 25.000000
and so one ... -
The .lvm file generated by the Write to Measurement File Express VI includes column heading titles for the y values, but they are a default value of "untitled". See attached example of a sample file when opened in Excel, the values in question are highlighted. Is there a way to specify the column titles when the file is written?
This is a similar question to this posting, which received a work around response to use the Write to Spreadsheet File.vi, rather than a solution when using this VI.
Message Edited by Hightop Raven on 05-02-2007 03:37 PM
Attachments:
column_titles.gif 13 KBSorry for the late reply. I was out of the office Friday.
You can do it, but the code can get rather ugly. Under the hood, the dynamic data type (the dark blue wire) is an array of waveforms. In your case, the scalar values you convert to a dynamic data type are being converted to an array of waveforms, each waveform having one element. You have two options.
Explicitly convert your scalars to one-element waveforms (t0=0, dt=1) and add the title before conversion to a dynamic data type.
Convert your dynamic data type to an array of waveforms and loop through them to add the column labels. The conversion blocks are in the Signal Manipulation Express palette.
I would recommend 2, since it is the easiest to add. It is also the easiest to run only on the first iteration. Just put a case selector around the loop, wire the selection to the While loop iterator, and set the case containing the label code to 0. The default case simply passes through the dynamic data.
My apologies for not including a screen shot. I am in the process of upgrading my machine and can't run LabVIEW. If you need one, let me know and I can post one tomorrow.
This account is no longer active. Contact ShadesOfGray for current posts and information. -
Formatting the time stamp in "Write LabVIEW Measurement File"
When I use the "Write LabVIEW Measurement File" vi to write data
the files first column contains the number of seconds since the staart of the file
How can I get the computer date and time or at least the time HH:MMS???
Tom
PS, And how can I put some sensible label on each columns in the file?Tom,
The vi I'm attaching demonstrates how to use the computer system time for the timestamp on your LVM file. It takes a reading from the DAQ Assistant and applies a system time stamp. It's in version 7.1, but let me know if you need it in version 7.0.
As for inserting meaningful column headers, you won't be able to do that with the express vi, but you could use the regular file i/o vis to create a file like that is similar to a LVM file, but is a little more customizeable and can be formatted however you like. The express vi is meant to be a quick solution, but does not offer all the versatility of the vis on the palette. I hope this helps you out. Have a good one, Tom!
Tyler S
Attachments:
LVM_timestamp_7_1[1].vi 265 KB -
Write to measurement file timing
I am trying to make a VI that allows the user to turn on and name channels through the front panel. After the user has configured the channels, they can push a button and record voltages from the enabled channels and save them using the "Write to Measurement File".vi. I would like the user to be able to record a measurement file that is consistent in length each time they push the button...in this case, 5 seconds of data. The current VI doesn't appear to be doing this...everytime I push the record button, the data gets recorded for 0.045 seconds. Apparently I must be missing something as this isn't behaving how I expected it to. See attached VI.
Attachments:
Select Channel rev 3.vi 244 KBIt waits 5 seconds then saves the last 10 samples. Because that is the way you programmed it. The while loop returns only the data from the last iteration.
Two ways to do what you want: 1. Read 5 seconds * 200 samples/second = 1000 samples. No loop required.
2. Read 10 samples at a time and accumulate the data until you have 5 seconds of data. To avoid memory reallocations the way to do this is to Initialize an array with 1000 elements outside the loop. Wire it to a shift register. Inside the loop Read the samples and use Replace Array Subset to put the new data into the initialized array. Wire the output of the shift register to the file VI.
You generally should not put any time consuming code inside an event structure. Read the caveats in the detailed help for the event structure. Consider a Producer/Consumer architecture.
Lynn -
Include time stamp in Write to Measurement file
Dear Experts,
I would like to include the time stamp in the data sheet I saved using a Write to Measurement file. Currently only 1 column of data was saved without the time stamp. Is there anyway I can save the data together with its time stamp in a single file (side by side column)?
Thank you.
Regards,
CYTeohDid you configure the Express VI to create a time channel:
Christian -
Hello,
I have to measure my spectrometer values every thirty seconds and have to write it to a text file. I need to create a new text file each time for writing my values. So i used the write to measurement File option for doing this. The problem is that this block measures the values only every one minute, but i need to measure the values every thirty seconds. Could any one help me out with this ?
Thanks in advance
SwarnaSome issues you have for the timing part of your code:
1. Use the Time has Elapsed output of the Elapsed Time VI. It already does the comparison for you, so just use it.
2. I'm pretty sure you want the Write Measurement File to be in the TRUE case.
3. Use the AutoReset option on the Elapsed Time VI.
But those do not point to a data point every 1 minute. How long does it take your instrument to do the sweep before sending it to you? I have seen some take a long time, so it is worth looking into. -
Write to Measurement file wil not write data daily
I have been using the Write To Measurement File express VI to record daily values. The express VI is no longer saving daily files or is checking for file size. WTF. Does anyone have a more bullet proof way of saving data daily with a single header for the day?
Thanks,
MattMS UCD wrote:
Ravens Fan,
So to clarify, I meant local variable instead of shared variable. Shared variables will come into play when I construct the real-time embedded program on the cfp-2120 controller. Thanks for the clarification. So are you on the clock for all this?
Sometimes yes, sometimes no. Since today is a holiday, I'm off the clock.
Anyways, so if I need to have the user see the values on the front panel and also record the values later, how do you suggest one does such a thing other than writing an indicator and then making a local variable that is then recorded?
The local variable has nothing to do with recording the values later. It is just a way of accessing a control or indicator in more than one part of the program. If you used shared variables (and I think you would need to have the DSC module to have this functionality), you could write to the shared variable and have it set up to log its values to the Citadel database. It is a built-in method of logging that just requires configuration of the shared variable, no additional programming would be needed. Otherwise you will need to add the code to write to a log file like you are doing now.
The new/old mechanism for checking the date has brought the adequate functionality I was looking for- mainly new files for each day.
With respect to the race condition you mentioned, could a sequence structure be used to write the local variable to the output array? In essence, I would calculate the scaled values and then write them to the data array. Another solution could be a control in the last case that then is used to initiate a case structure in which the shared variables for the data acquisition iteration are then recorded in the output array.
A sequence structure (and a flat sequence is preferable to a stacked sequence for code readability and maintainability) would guaranteed that one section of code completes before another begins. However, it is still preferable to use wires. Wherever you are wiring to a local variable, just send the wire to the border of the while loop. Feed the wire from that tunnel to the build array function and eliminate the local variable that you are reading there. Your case structure in a while loop is really just functioning like a stacked sequence structure. Every iteration of the while loop executes the next case in the case structure. If you are sequencing through the data values in the same order that you are building them into an array outside of the loop, you could actually build the array element by element inside each case structure and use a shift register on that array to carry the data from one iteration of the while loop to the next. Then once you while loop is done, the array has already been built. If by chance you are acquiring the data in a different order then you want to build it into and array, then the array functions could get much more complicated inside the case structures. But you could initialize the whole array before the case structure, and use replace array subset to replace each specific element as you acquire it.
I am interested in the producer/consumer arrangement you speak of. Do you have an example you could send me that shows this operating?
Go to File then New.... Look under frameworks, design patterns, and Producer/Consumer Design pattern (Data). Also search the forum for producer/consumer and I'm sure you'll see plenty of examples.
As for the Time Signal controls being located in the Labview abyss, what can I say? Every learning experience has a few bugs. ; - ) If the Time Signals are constants what effects on the time in the chart will this have?
Since the time controls are way off, I assume that the program user will never actually go out into the space of the front panel to find them and change them during the execution of the code. (I am also assuming that those controls never get changed programmatically by writing to a local variable or property node or they are not part of the connectory pane where this VI is called as a subVI in another one that passes in a time stamp on every call.) If they never change, then they are effectively constant. Changing them into constants would clean up the code and make it slightly more efficient, but would not appear to execute any differently.
Thanks for helping this novice out!
Regards,
Matt -
"Write to measurement file" express VI (TDMS foormat) keeps file opened
Hello!
I am trying to use "Write to measurement file" express VI to write TDMS data obtained from DAQmx in LV2011. Each run of the same write function creates new file.
It seems that last written file remains to be opened until program stops or next file written. It has 0 size and it is not possible to access it from other programs.
Is it possible to save file immediately and close it?
Solved!
Go to Solution.It seems, that wiring "DAQmx task" (for AI task) to "Write to measurement file" express VI does not works in my case (only in exe).
The error is the same as file not found (error code 7), but file is created. Something gets wrong inside express VI. I am unable to debug exe, so I have just disconnected DAQmx task from express VI (really don't specially need it anyway).
For sure, the same LabVIEW version and drivers are installed on target and VI is working in it as well as at dev machine.
Debug error which I had encounter is already published in the forums elsewhere. It seems that the problem is in VI without block diagram inside hierarchy. Maybe with Express VI.
PS test app writing tdms files the same way is working like a charm (without DAQmx task wired).
So, thank you for yor advices, the problem seems to be solved. Maybe I will have a look in more details about the reason of such error, but can't do it now. -
Write to measurement file Express VI - TDMS file has separate "channels" for each data point
Im trying to write a VI to measure and record thermocouple data from an Advantech T/C DAQ. Using the "DAQNavi" express VI provided by them, connected to the Write to Measurement File express VI, I have managed to read in the data and create a TDMS file. However, when I open the TDMS file, each time step of temperature data is entered as a separate channel, instead of all of the channel data going into one tab. Obviously this is a huge problem as it creates hundreds of tabs after just a few seconds. Any thoughts as to what causes this?
Hi glibby,
How did you configure the Write to Measurement Express VI? Please select "one header only".
If you have your own timestamps to write, please merge your timestamp channel and measurement channels with "Merge Signals" before passing them to the Write to Measurement.
Best Regards,
Mavis
Maybe you are looking for
-
Work-around for Mavericks USB-sync crippleware?
Has anyone found one? Does reinstalling 10.8 work? I grudgingly started using iCloud when I had no choice. It is not reliable. Constant problems syncing calendars, contacts, mail accounts, etc. And I am currently in New York City, with excellent mobi
-
Here's the issue... I just upgraded from Windows XP at work to Windows 7. I have Adobe Acrobat 8. I know that there are some issues with printing and stuff since CS3 doesn't quite work with Windows 7. The patches, etc, help some. I used to be able to
-
OS Windows 7 (64). Photoshop CS5 Extended, v.12.1. Lightroom 3. When I open an image in photoshop that has been modified using a plug in (e.g., Alien Skin Snap Art 4) the changes made to the image do not appear. The original image appears. When I
-
Windows iTunes never finishes updating iPhone without bricking it...
So, I work at a mostly PC (Read: We only have two Macs - This kills me) job. The head of the company recently purchased an 8GB iPhone (2nd Gen), when the 3GS came out. Every time a new iPhone software revision comes out and he chooses 'update,' it gr
-
I was trying to use imessage to share a photo with iPhoto. I go the message "couldn't communicate with a helper application" My iMessage works fine for everything else. I am currently running yosemite and every app has been updated. I restarted the