LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Folder

Hello,
I am developing my thesis for which I have to make a software in labview.
I can not solve a problem:
I have a folder (Datalog) from which I have to open and read cyclically folders in it (Sart 01, Sart 02, ....), of which I want to read the last file contained in them (I'll pull out the location of the last file and read it with another subVI).
Please, can you help me?

Thanks.

I attach the images of the front panel and block diagram

Download All
0 Kudos
Message 1 of 5
(2,685 Views)

Hi gmazza,

 

THINK DATAFLOW! You have race conditions and other mis-understandings in your code...

 

Use autonindexing for arrays! See this:

check.png

 

You should define "last file" more accurate: last by name (which sorting order), last by creation date, last by what else?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 5
(2,679 Views)

Hello,
Last files by date!
Your code is fine but returns only a path (relative to the last file of the last folder (Sart 03)). I need the program returns three paths (one for each folder Sart).

0 Kudos
Message 3 of 5
(2,659 Views)

If you don't improve your fundamentals in LabVIEW it's unlikely you will get to an end.

You already got a correct solution in this thread.

 

Take the time to read the documentation of any function you don't know well.

Search "autoindexing" in the help and learn how it works: to understand it (like some other very basic concepts) is a must!

In your diagram the code in the loop doesn't depend whatever way on the iteration, so every iteration does the same action!

To better understand code, set the Highlight execution mode and use probes to see what data pass through the wires.

Try to understand dataflow: in your original code you are using the local "size(s)" before setting its value!

 

GerdW's code doesn't return a single path: it returns an array of paths.

If you get a single element in the array, it means that:

a) there is only one subfolder

b) you made a mistake copying the code, probably missing autoindexing on either the loop input or output

Paolo
-------------------
LV 7.1, 2011, 2017, 2019, 2021
Message 4 of 5
(2,641 Views)

@gmazza wrote:

Hello,
I am developing my thesis for which I have to make a software in labview.
I can not solve a problem:
I have a folder (Datalog) from which I have to open and read cyclically folders in it (Sart 01, Sart 02, ....), of which I want to read the last file contained in them (I'll pull out the location of the last file and read it with another subVI).
Please, can you help me?

Thanks.

I attach the images of the front panel and block diagram


Excuse me, gmazza, you have been asking a LOT of basic LabVIEW questions over the past few months, then, it seems, needing to have additional help adapting answers you receive to your particular problem. Now, there is nothing wrong with getting help from those who know the language better than you.

 

But if you're "developing a thesis" which has writing a LabVIEW program as an integral part of it, then you would be much better off thoroughly learning LabVIEW (learn how to spell it, anyway) the hard way, by slogging through online tutorials, books, writing your own code and figuring out what's wrong with it with absolutely minimal help from others - above all, not pasting someone else's code into your program.

 

Then, when you graduate, you can put "LabVIEW programming" on your resume with confidence that a prospective employer will not hire you and then be disappointed with your knowledge of the language.

 

After all, a thesis (graduate level, I assume) is meant to be a testament to both the skills in the author's specific discipline and his/her general problem-solving ability. At least, that's the way I was taught and subsequently taught others.

 

Trust me, it'll make you a better engineer/programmer/scientist in the long run. Don't fear asking help when you're really stuck, we won't bite, but then do your best to understand it fully and adapt it to your situation. There's a real treasure trove of good information in the LabVIEW help files and the gazillion web pages NI has up about the language (including archives of the forums).

 

Cameron

 

To err is human, but to really foul it up requires a computer.
The optimist believes we are in the best of all possible worlds - the pessimist fears this is true.
Profanity is the one language all programmers know best.
An expert is someone who has made all the possible mistakes.

To learn something about LabVIEW at no extra cost, work the online LabVIEW tutorial(s):

LabVIEW Unit 1 - Getting Started</ a>
Learn to Use LabVIEW with MyDAQ</ a>
0 Kudos
Message 5 of 5
(2,619 Views)