LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Element to Array causing data type mistmatch when using For loop

Is there anyone can help to give the solution how to fix it? The element is converted to array because I would like it to run with difference inputs array.

 

Labview_issue_encounter.PNG

0 Kudos
Message 1 of 7
(1,005 Views)

The number of iterations is a scalar integer. Wiring an array to it makes no sense.

 

Why exactly did you change to arrays and what exactly are you trying to do. How does the front panel look like?

0 Kudos
Message 2 of 7
(980 Views)

Actually I am trying have multiples control inputs in orders to execute each row of input automatically as you can see the picture on the left(Initially-> only element) and on the right(After -> change to arrays control) cause connected to two difference type . Can you suggest how to do it ?

 

Example, After input 1st row of control data, it will process and output at 1st row of output array. And after that, it will automatically proceed to 2nd row of data, and output at 2nd row of output array and so on..

 

 

Labview_issue_encounter1.png

0 Kudos
Message 3 of 7
(970 Views)

Hi

 

Remove the wire I have marked with blue:

AndersSekanina_0-1701941062496.png

It will work because you have indexing enabled on your arrays when you enter the for loop.

 

Alternative replace the "to I32" function (marked with black box) with "Array size" function, then it will also work as you want.

 

Anders Pedersen Sekanina
sekanina.dk




0 Kudos
Message 4 of 7
(921 Views)

@Michael_Lim wrote:

Actually I am trying have multiples control inputs in orders to execute each row of input automatically as you can see the picture on the left(Initially-> only element) and on the right(After -> change to arrays control) cause connected to two difference type . Can you suggest how to do it ?


Press ctrl+B...

 

The broken wire doesn't work (because 1) it's an array and 2) N should be the number of iterations).

 

The broken wire is redundant, the arrays are auto indexed, causing the for loop to iterate the array size's times.

 

Alternatively (try it to learn), insert an Array Size between the array and the for loop's N. This is redundant in this situation (because the auto indexing takes care of the size), but it shows how N should be used. Try decreasing and increasing the returned array size, see what happens.

 

EDIT:

This might not be exactly what you want, but you've made it a bit hard to see what you want (for the computer and for us). Do you want several step sizes and biases? Then you probably need 2 for loops: one for looping through the settings, a 2nd for looping through each setting's steps.

 

You could consider processing the steps before looping through them. E.g. make a table with points to be send, in a separately testable SubVI, then send them. That will separate complexity and make your life easier.

0 Kudos
Message 5 of 7
(917 Views)

Noted. Will try it out. Thanks

0 Kudos
Message 6 of 7
(886 Views)

Maybe all you need is an outer FOR loop that iterates over these arrays.

 

Please attach your code instead of showing us truncated pictures and explain exactly what the code should do with these arrays.

 

I can see several other glaring problems, for example why is all this inside an event structure??? Why do you have an orange "counter"? Why don't you use the "+1" primitive? Why do you have a control on the feedback node initialization?

0 Kudos
Message 7 of 7
(853 Views)