09-06-2013 02:53 AM
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
09-06-2013 03:06 AM - edited 09-06-2013 03:06 AM
Hi gmazza,
THINK DATAFLOW! You have race conditions and other mis-understandings in your code...
Use autonindexing for arrays! See this:
You should define "last file" more accurate: last by name (which sorting order), last by creation date, last by what else?
09-06-2013 03:31 AM
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).
09-06-2013 04:07 AM
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
09-06-2013 08:08 AM
@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