LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Issue with variables passing through loops

I have this situation where I have many variables, but when I get through the loop that evaluates the variables in matlab, only the first two pass through.  Any idea why my code is doing this?  

0 Kudos
Message 1 of 12
(3,434 Views)

Hi jmaslek,

 

attaching a VI, which relates on a LVOOP class quite heavily, is senseless when we don't have access to that class…

 

Why do you need MATLAB nodes to evaluate those functions?

Why are there Matlab nodes which don't create any outputs?

And do you really need 2D arrays of OOP objects?

Best regards,
GerdW


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

Hello and thanks for the reply.  We are using matlab nodes because we have several user defined functions that are stored there.  Some have no outputs so that they initialize the variables and their variables. 

 

Honestly, I am not sure where the 2D arrays are, when I control+H and scroll over the wires, they all say 1D arrays.

 

I am attaching a ZIP with the LVCLass and associated VIs

0 Kudos
Message 3 of 12
(3,416 Views)

Hi jmaslek,

 

there are still a lot of (inherited?) classes missing!

 

And the 2D array is formed at the output of your two stacked FOR loops using autoindeing tunnels: each loop border adds a dimension to the array! (Pretty basic LabVIEW stuff…)

Best regards,
GerdW


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

I see now.  I was only looking at the input of the loops 😐  Those don't seem to be causing an issue, because I am using a property node (unless that is an issue) with the lvclass as a reference.

 

My issue comes in that my loop only goes through 2 iterations, no matter how many variables I have in my class.

 

 

0 Kudos
Message 5 of 12
(3,403 Views)

Hi jmaslek,

 

My issue comes in that my loop only goes through 2 iterations, no matter how many variables I have in my class.

The rules for FOR loop iterations are rather simple:

- the value wired to the "N" input of the loop

- the size of arrays (or better: the size in N-th dimension of a N-dimensional array) for autoindexing input tunnels

The smallest number "wins" for all of those input parameters.

 

So when a FOR loop only iterates twice then one input is limiting this to just 2 iterations!

Ever used probes to find out?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 6 of 12
(3,391 Views)

I have been probing.  I am attaching a couple images that show the probes.  At 14, the probe shows 4 variables, (a,b,c,d).  But the probe at 13 only alternates between a and b.

Download All
0 Kudos
Message 7 of 12
(3,388 Views)

Hi jmaslek,

 

the loop has more than one input tunnel!

 

I repeat from my last message:

The smallest number "wins" for all of those input parameters.

 

Do you get my point now?

You need to read messages more carefully!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 8 of 12
(3,380 Views)

Okay I see now that there is also the error in, which has 2 elements (i.e. the two iterations).  That fixed that, but I run into more errors,  telling me there is an invalid input parameter at a certain VI (VariableManager.lvclass:Write SequenceValues" but only when the sequence boolean is false.

 

If I insert a probe, LV crashes immediately without the error message.

0 Kudos
Message 9 of 12
(3,375 Views)

Check your OOP classes…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 10 of 12
(3,373 Views)