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.
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.
06-23-2015 02:26 PM
Hi folks,
I am trying to figure out how to block some values from entering an array,
right now I have a make shift pattern function that depending on what the user enters
will go through a file and pass through the name of the file if it matches the parameters
and that file name will get passed as a path to a file and subsequently that files data will be graphed.
The only problem I'm having is when no values are entered, files are being passed to the array
but with no data, so that is getting passed as the file path and I am getting an error which states
that the file can not be found.
So what I am hoping for is someone who can help me stop indexing the array if no match has been found
I dont' know if that is possible. Right now when I run it it is fine shows the matched files but blank spots for
non matched, for how ever many files are in that specific folder.
06-23-2015 02:34 PM
some learning materials:
https://decibel.ni.com/content/docs/DOC-40451
Post your code, you will get help faster, and you have to write less...
Case structure could help maybe?
06-23-2015 02:38 PM
Sorry I didn't know,
basically all I want is to only pass data to the array that I need, which would be the files that match the user input.
06-23-2015 02:50 PM - edited 06-23-2015 02:51 PM
Hi jackson,
cleaning up your code isn't important to you, isn't it? 😉
- When you know the number of iteration before entering a loop you SHOULD use a FOR loop!
- Learn about autoindexing of arrays at loop borders, it's a VERY important feature in LabVIEW!
- THINK DATAFLOW: Using a "default if unwired" tunnel most often is wrong - as in your VI…
- Are you using LV2014? Use a conditional output tunnel…
- Are you using an older LabVIEW version? Learn to use shift registers!
06-23-2015 02:51 PM
If you are using a relatively-recent version of LabVIEW (I know 2012 has it, maybe 2011 as well?), look into using the Conditional Indexing tunnel on For or While loops. This lets you choose, element-by-element (via a Conditional test that you create) whether or not to put an element into an array, just what you seem to want.
Bob Schor
06-23-2015 02:53 PM
Thanks Bob but I am using version 9 unfortunately.
06-23-2015 03:03 PM
This obviously is a rough draft, your condescending tone is not helpful, i've been using labview for a week.
Also you used isn't it, instead of is it.
06-23-2015 03:14 PM - edited 06-23-2015 03:18 PM
Hi jackson,
thanks for teaching me English as it's not my first language.
I will teach you aspects of LabVIEW as I'm the one of us with more experience… 😄
- The differences between FOR and WHILE loops are not specific to LabVIEW, they have their specific purpose in each programming language.
- Autoindexing is explained in the beginner courses offered for free on NI website.
- DATAFLOW is the very heart of LabVIEW, you NEED to understand it!
- I mentioned the same conditional tunnel as Bob.
- I mentioned the "old-fashioned" solution to your problem. You will understand it after taking the free lessons and looking at the example VIs coming with LabVIEW…
06-23-2015 03:17 PM
It is important to keep a clean code when you program, try to avoid backward going wires, and too large block diagram. etc... You will see it really helps during development.
I really like the following "mini" guide, it can give you some usefull tips how to work in LabVIEW:
http://www.ni.com/newsletter/51735/en/
When you get advice from people in this forum, do not take it like an offense. It is not toward you, it is toward your VI lets say 😉 Everyone starts as a beginner, and you learn faster if you listen to the more advanced programmers...
06-23-2015 03:28 PM
I am using a while loop because I don't know how many times the user is going to want to go through my program, I know auto indexing for while loops is not a default so I turned it on, I am not sure what you are referencing.