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: 

block values from entering array

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.

0 Kudos
Message 1 of 17
(3,228 Views)

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?

0 Kudos
Message 2 of 17
(3,219 Views)

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.

0 Kudos
Message 3 of 17
(3,213 Views)

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!

 

 

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 17
(3,190 Views)

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.

Conditional Tunnel.png

Bob Schor

0 Kudos
Message 5 of 17
(3,186 Views)

Thanks Bob but I am using version 9 unfortunately.

0 Kudos
Message 6 of 17
(3,177 Views)

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.

0 Kudos
Message 7 of 17
(3,168 Views)

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…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 8 of 17
(3,154 Views)

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

 

0 Kudos
Message 9 of 17
(3,142 Views)

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.

0 Kudos
Message 10 of 17
(3,131 Views)