LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Multiple Array

Here is one possibility to calculate the sum of the 4 element subset (array subset) starting with row index 3, multiplied by the max/min controls and taking the sum.

 

There are many other ways to do this, of course. (you can even omit one of the sums, but it'll costs more memory).

 

altenbach_0-1664128604203.png

 

0 Kudos
Message 11 of 19
(1,162 Views)

this parameter csv

 

0 Kudos
Message 12 of 19
(1,158 Views)

Thank you very much for the advice sir, I will try to learn more about the Vi program to solve my case

0 Kudos
Message 13 of 19
(1,157 Views)

I want to make array multiplication in LabVIEW like the source code below but I'm confused to make it in VI forms can anyone help me?

 
Datarealtime = [1.751933    0.600301    -0.532437   -0.399414];
Bias = -6.6169046946979;
for i = 1:length(DataArifS5)
    Jmlh(i) = DataArifS5(i,1)*DatatrainingS5(i,2)*((Datatraining(i,3)*Datarealtime(1,1))+(Datatraining(i,4)*Datarealtime(1,2))+(Datatraining(i,5)*Datarealtime(1,3))+ (Datatraining(i,6)*Datarealtime(1,4)));
end
jumlah = sum(Jmlh)
hasil = jumlah+Bias
0 Kudos
Message 14 of 19
(1,117 Views)

Just start with my example.

0 Kudos
Message 15 of 19
(1,100 Views)

@Array01 wrote:

I want to make array multiplication in LabVIEW like the source code below but I'm confused to make it in VI forms can anyone help me?

 
Datarealtime = [1.751933    0.600301    -0.532437   -0.399414];
Bias = -6.6169046946979;
for i = 1:length(DataArifS5)
    Jmlh(i) = DataArifS5(i,1)*DatatrainingS5(i,2)*((Datatraining(i,3)*Datarealtime(1,1))+(Datatraining(i,4)*Datarealtime(1,2))+(Datatraining(i,5)*Datarealtime(1,3))+ (Datatraining(i,6)*Datarealtime(1,4)));
end
jumlah = sum(Jmlh)
hasil = jumlah+Bias

  • One thing you need to know is that array indices start with zero in LabVIEW, so the first element has index=0, not 1.
  • If you autoindex a 2D array at a FOR loop boundary, you'll get one row (1D array) at a time inside the loop. You should not wire N, because the number of rows will automatically determine that when autoindexing.
  • Your datarealtime array is 1D, not sure why you think you need two indices. As I demonstrated in my example, if you don't autoindex, the 1D array, you get it inside the loop unchanged and multiplying with the correct row subset will do the multiplication elementwise.
  • ...

I recommend you start with the learning resources listed at the top of the forum.

 

0 Kudos
Message 16 of 19
(1,075 Views)

Thanks for the response and suggestion sir
sorry, I want to ask about the for loop in Labview, can it be used as a counter of the array index to move the first line to the second line? as in other programs such as python, C++ and others.

0 Kudos
Message 17 of 19
(1,066 Views)

@Array01 wrote:

sorry, I want to ask about the for loop in Labview, can it be used as a counter of the array index to move the first line to the second line? as in other programs such as python, C++ and others.


I have no idea what you mean by that!

 

Indexing is zero based, so you can do simple math to convert your index into a LabVIEW index. (This comes to mind). When autoindexing, you don't even need to worry about indices, because you get one row at a time in the correct order.

0 Kudos
Message 18 of 19
(1,061 Views)

Hi Array,

 


@Array01 wrote:

I want to ask about the for loop in Labview, can it be used as a counter of the array index to move the first line to the second line? as in other programs such as python, C++ and others.


This is called "Autoindexing" - and is a very basic feature in LabVIEW.

 

Did you start with all those Training resources offered at the top of the LabVIEW board? I guess you already got a recommendation to tackle them!

Best regards,
GerdW


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