LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

for and case structure do not accept inputs

Solved!
Go to solution

Hello everyone,

im trying to interate over the columns in my array that I read from a file: This is my program:pr.png

When I add an indicator to the size of my array it gives me the right number N that I want as my input to the for loop:for indicator.png

Now comes what I didnt expect: When I now try to attach that number to N, it gives me an error that source and sink are not compatible though of the same type:

for er.png

 

Its not a big deal for my application so I just attached a constant because that array size does not change usually, so I had a workaround. The problem is that the weird error repeated to occur: I am trying to find out if the first element in my row is -1 and do something with that in a case structrure. So I used a comparison operator, that gives out a bool. If I add an indicator again, everything works as expected: as indicator.png

Now when i try to attach the bool to my case structure it ceases function:

to case.png

I am working with labview for a few weeks now and came quite far but this confuses me a lot. Am I doing something wrong or is my Labview (v.2015) installation corrupted maybe?

 

Thanks for reading

derbengale

 

0 Kudos
Message 1 of 5
(1,313 Views)
Solution
Accepted by derbengale

Okay I see what I did there i attached an array instead of a single bool.. This can be deleted

Message 2 of 5
(1,310 Views)

Hi derbengale,

 


@derbengale wrote:

im trying to interate over the columns in my array that I read from a file


When you want to autoindex columns instead of rows of a 2D array then you may transpose the array before the loop…

Best regards,
GerdW


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

@GerdW wrote:

Hi derbengale,

 


@derbengale wrote:

im trying to interate over the columns in my array that I read from a file


When you want to autoindex columns instead of rows of a 2D array then you may transpose the array before the loop…


Adding just a bit to what GerdW wrote, you should not have the count terminal wired when you're using autoindexing. LabVIEW will take care of counting the length of the array for you. 

0 Kudos
Message 4 of 5
(1,233 Views)
  • There is an optional input to the read function that gives you the transposed array right away If that is useful.
  • Taking a subset starting with zero and the length unwired is a NOOP and just returns the input unchanged. Why is it there?
  • Since you have an array for the comparison, but need to make a single decision, you need to decide if you want the case to be true if at least one element differs from -1 or only if all elements differ from -1. These are not the same. (Also be aware that comparisons (equal, not equal, etc.) on orange wires can be very dangerous.

I really recommend to start with some basic LabVIEW tutorials instead of jumping into the deep end and randomly wiring things together until no wires are broken. Even if there are no broken wires, the code can still be highly flawed. 😄

 

Also, it typically helps to attach your broken code (and example data file) and explain exactly what you are trying to do, not how you are trying to do it. Once we know what you want, we can probably come up with an alternative that fits on a postage stamp and is 90% simpler. 😄

0 Kudos
Message 5 of 5
(1,155 Views)