From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Save Files to USB and computer simultaneously

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.

 

 

0 Kudos
Message 1 of 15
(3,695 Views)

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.

0 Kudos
Message 2 of 15
(3,687 Views)

@nicksony231 wrote:

[...] With the pic attached [...]


The Code Capture Tool would have helped here.

Jim
You're entirely bonkers. But I'll tell you a secret. All the best people are. ~ Alice
For he does not know what will happen; So who can tell him when it will occur? Eccl. 8:7

0 Kudos
Message 3 of 15
(3,673 Views)

I print screened it. I didnt want to upload the whole file

0 Kudos
Message 4 of 15
(3,636 Views)

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

0 Kudos
Message 5 of 15
(3,583 Views)

In LabVIEW 7.1 it's called List Directory.

0 Kudos
Message 6 of 15
(3,575 Views)

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

0 Kudos
Message 7 of 15
(3,570 Views)

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.

0 Kudos
Message 8 of 15
(3,562 Views)

@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.

0 Kudos
Message 9 of 15
(3,544 Views)

Thanks, appreciate the help. More specifically which N by X 2D array in the shift register would i use?

0 Kudos
Message 10 of 15
(3,536 Views)