LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Re: compare arrays

Hi Dennis and everyone else in this post.

 

I have a question that will most likely be easy for you. I want to compare elements of the same array.
In a different programming language it would be easy to loop over the different elements of a matrix and compare the values and even do some calculations (substract one element from all the other etc). In LabVIEW I find it somehow difficult as I am not so familiar with it. What I would like to do first is to loop over a row of a 2D array check which element has the minimum value there and substract from all the other elements of this row (including itself). Then do the same for all the rest of the rows and then do the same for all the columns of the 2D array. This way I want to get rid off of any offset in my data.

I am sure it is possible and you guys can figure out an easy way to do it. My mind right now goes into too complicated things..

Thanks for any help!

0 Kudos
Message 1 of 7
(3,859 Views)

please don't post in old threads, unless you have something relevant to contribute or update the specific discussion.

 

make a new thread for your question.

.

 also .. you should start with the standard labview introduction tutorials.

have a look at the top of the labview board.

the self-paced-learing courses if you have SSP are very much recommende.

 

 


If Tetris has taught me anything, it's errors pile up and accomplishments disappear.
0 Kudos
Message 2 of 7
(3,855 Views)

Hi stuleo,

 

that's why you bring a 13 year old thread back to live instead of starting your own discussion?

(I moved your question into it's own thread.)

 

I am not so familiar with it.

NI provides a lot of learning tools/tutorials to start with…

 

loop over a row of a 2D array check which element has the minimum value there and substract from all the other elements of this row (including itself). Then do the same for all the rest of the rows and then do the same for all the columns of the 2D array. This way I want to get rid off of any offset in my data.

What have you tried so far?

Where are you stuck?

 

It's quite simple:

check.png

When you want to process columns in a 2d array you could transpose it… 😄

 

This way I want to get rid off of any offset in my data.

You don't say anything about the nature of your data - but wouldn't it be easier to subtract the overall minimum from all elements of your 2D array?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 3 of 7
(3,849 Views)

hehe .. i waited for the new post 😉

wanted to post the same,

although i didn't understand why the columns should be done after the rows have been done already.


If Tetris has taught me anything, it's errors pile up and accomplishments disappear.
0 Kudos
Message 4 of 7
(3,838 Views)

Thank you both for your replies.

I didn't mean to distrurb the post from it's 13 yo sleep I just thought it would be better to continue on this since my question is quite relevant and might be of use for someone else that will start reading this post instead of opening several ones to find an answer to their question.
I have been through the introductory tutorial videos and they were really helpful but they don't go into much detail and I couldn't find an answer to what I was looking for.

At the moment I have an Index Array that sends to an Array Max&Min inside a for loop that is controlled by the size of the array (using the column size).I am able to extract the columns with the Index only pointing to the column number and the row index floating (as was suggested above). Next step I will try to combine the extracted columns into a 2D array again and do the same for the rows of the 2D array.

I hope this will work for me. Thank you for your help.

0 Kudos
Message 5 of 7
(3,834 Views)

you are welcome to post you code, either as snippet (look at the menu of the blockdiagram Edit->Create Snippet) or the .vi

and you will get helpful critique.

 

note that most of the "comparison" and "numeric" functions work on arrays

some have the ability to be switched (via right mouse) like the "equal" function.

 

a suggestion for good questions, is that you state the desired end result,

and then describe your current idea of working towards it.

that helps "us" to better help you

 

cheers and have fun playing with labview .. for quick tests it is always good to CTRL+N 😉


If Tetris has taught me anything, it's errors pile up and accomplishments disappear.
0 Kudos
Message 6 of 7
(3,826 Views)

Hi stuleo,

 

At the moment I have…

When we ask for code ("What have you tried so far?") we want to see code (aka VI or snippet) - not just a textual description of your code…

 

it would be better to continue on this since my question is quite relevant and might be of use for someone else

But it's not related at all to "comparing array elements"…

Best regards,
GerdW


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