LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Computing arrays using formula nodes

As shown in the attached file, only the second line is calculated. Could you also teach me how to modify the vi program?

kozuka32_0-1698392245647.png

0 Kudos
Message 1 of 14
(1,055 Views)

You don't need any Interation input on the loop if you use Autoindexing.

I have no idea what that to-from Dynamic data does, but you somehow convert a row (2 element array) into a scalar, so it is correct that you'll only get a 1D array out.

Activate the Highlight execution and Retain values lamps on the quickbar and you'll figure out what happens.

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 2 of 14
(1,052 Views)

Hi kozuka,

 

you really, REALLY (!); should forget about those FromDDT/ToDDT ExpressVIs completely!

And you should also try to replace those formula nodes with basic LabVIEW functions!

 

Then it becomes much easier to follow your code:

I already implements some simplifications, like replacing the lower loop by a simple IndexArray/BuildArray. (You might use ArraySubset to simplify even more!)

Your other formula nodes could be replaced by simple functions from comparison palette...

Best regards,
GerdW


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

@kozuka32 wrote:

As shown in the attached file, only the second line is calculated. Could you also teach me how to modify the vi program?

 


Obviously, you seem to be coming from a text programming background and tend to gravitate to the old habits. You should never need a formula node, LabVIEW is perfectly able to do what you need graphically. Have you looked at the learning resources listed at the top of the forum? (and as has been mentioned, dynamic data and express VIs don't belong in simple array processing!)

 

Maye you should also explain in words what the processing is supposed to do.

 

It helps to fill all your controls with typical example data as default before attaching (do you know how to do that?), then explain the result you would expect from them. You did not even explain what "the second line" is. Are you talking about rows or columns?

0 Kudos
Message 4 of 14
(992 Views)

Hi, Mr GerdW

Thank you for your always easy to understand explanations. I tried creating it using it as a reference, but an error occurs as shown. I thought I created it using the content you created, but what is the problem?

kozuka32_0-1698636700969.png

 

0 Kudos
Message 5 of 14
(924 Views)

Make sure your indicators are 1D arrays, not 2D arrays.

0 Kudos
Message 6 of 14
(910 Views)

Thank you for answering. My purpose is to display the results of the first line (black) and the second line (red). Currently, only the calculation results of the first line are displayed, but how can I display the calculation results of the first line on the second line as well?

kozuka32_0-1698644450625.png

 

0 Kudos
Message 7 of 14
(899 Views)

Although it doesn't look good, you can draw the desired state if you do as shown in the attached image. Is there a better way to write it?

kozuka32_0-1698646600445.png

 

0 Kudos
Message 8 of 14
(894 Views)

Hi kozuka,

 


@kozuka32 wrote:

if you do as shown in the attached image. Is there a better way to write it?


Surely there are better ways!

But now you only attached images: we cannot edit/run/debug them with LabVIEW!

Please attach your current VI so we can edit it…

 

Possible improvments:

  • Use better labels. Controls shouldn't be labelled as "Indicator"…
  • Cleanup the code to follow style guide!
  • Use IndexArray before the outer loop instead of inside (for Indicator2).
  • Use only one outer loop as both loops iterate the same number of times.
  • Both inner loops do the very same task: why duplicate code instead of re-using?
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 9 of 14
(889 Views)

@kozuka32 wrote:

.... as shown in the attached image.....

 

 


you may want to use a snippet, as Gerd did in Message 3 

 

 

0 Kudos
Message 10 of 14
(873 Views)