12-23-2011 01:41 PM
Im trying to write data to both the C drive and the F drive for my flashdrive. Im trying to make it so the program doesnt read an error and stop if something goes wrong with the flashdrive, for example if it becomes disconnected. With the pic attached, the file gets saved to F drive when false and saved to the C drive when true. This portion of the program is only referring to the flashdrive, i have a replica portion not shown that saves to the C drive fine. What im trying to go for is if the flashdrive is disconnected the file will be deffered to another path such as the C drive path shown rather than the program reading error.
12-23-2011 03:26 PM
So... you took an actual picture of your monitor and uploaded that. Instead of, I don't know, creating a screenshot using the operating system's tools, or actually uploading the file?
@nicksony231 wrote:
Im trying to write data to both the C drive and the F drive for my flashdrive. Im trying to make it so the program doesnt read an error and stop if something goes wrong with the flashdrive, for example if it becomes disconnected. With the pic attached, the file gets saved to F drive when false and saved to the C drive when true.
That's not what actually happens. The output of the Is Not a Number/Path/Refnum will not tell you if the drive is actually attached. All it's telling you is if the input is a valid path construction. It does no file I/O checking. If you want to test for the existence of the drive you need to use, for example, the List Folder function and wire in an empty path. The "folder names" output will contain the list of drives that the operating system sees.
Aside: You should not be specifying paths using strings. While you are using Build Path, you are also only using it to append the path to the drive letter. The actual path relative to the drive is being specified as a string. This makes the code OS-specific.
12-23-2011 08:32 PM
@nicksony231 wrote:
[...] With the pic attached [...]
The Code Capture Tool would have helped here.
12-26-2011 07:13 PM
I print screened it. I didnt want to upload the whole file
01-03-2012 11:58 AM
Hello,
Im using labview 7.1. I know the list folder function is available for labview 8.6, but seems not available in labview 7.1 functionality. Any other suggestions to achieve the same results from the list folder function?
Thanks
01-03-2012 12:17 PM
In LabVIEW 7.1 it's called List Directory.
01-03-2012 12:21 PM
Thanks for your response. I have another question to my data logging program. I have multiple channels and am trying to obtain a running average of the data. I was looking to use the mean pt by pt vi. Seems that I would need to use one for each channel. Is there a way or a polymorphic multiple channel function of this?
THanks
01-03-2012 01:21 PM
No, there's no polymorphic version of that VI that operates on arrays or waveforms. You'd need to create your own wrapper VI or just use multiple instances of it. It's re-entrant, so each instance will have its own memory buffer. Be aware that internally that VI uses a Build Array function, so depending on how much data you have, it may not be very efficient. You may find it more efficient to whip up your own version which simply holds the previous average and adds in a new value (or an array of values) to calculate the new average. This method would just store a single number rather than an array.
01-03-2012 05:15 PM
@smercurio_fc wrote:
You may find it more efficient to whip up your own version which simply holds the previous average and adds in a new value (or an array of values) to calculate the new average. This method would just store a single number rather than an array.
Here is a simple example for a single running average over N history points. For X channels, use a N by X 2D array in the shift register and tweak the rest accordingly.
01-03-2012 06:17 PM
Thanks, appreciate the help. More specifically which N by X 2D array in the shift register would i use?