LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

2D arrays elements extract and calculate

Please help.

I have 2D array (m x n). I want to read each row and extract row
elements. Then I need to compare these with previous row elements. Can
anyone please guide me ?

Thanks

0 Kudos
Message 1 of 4
(3,373 Views)


venurg@gmail.com wrote:
I have 2D array (m x n). I want to read each row ...
Just feed it into a FOR loop. It will autoindex and at each iteration you'll get one row until all rows are processed.


venurg@gmail.com wrote:
...and extract row elements. Then I need to compare these with previous row elements. Can anyone please guide me ?

Do you want to compare each row with the previous row or do you want to compare element by element. What kind of comparison?

For example, do you want to know...

  • ...if the current row is the same as the previous row?
  • ...how many elements are different?
  • ... if at least one element is greater than the same element in the previous row?
  • ...

To get you started, I am attaching a small example (LabVIEW 7.0) that tells which rows are the same as the previous row.


Message Edited by altenbach on 10-29-2006 09:32 AM

Download All
0 Kudos
Message 2 of 4
(3,365 Views)
Thanks a ton for the advice Altenbach,

I have few columns, each having a meaning. In the first column I have G
code which commands tool motion. In next columns I have X, Y and Z
co-ordinate commands.

I have to access G code in each row and then see what was there in the
previous row. Also calculate the tool motion based on X,Y and Z values
from present and previous row.

I hope I was clear enough in explaining my problem.

Please advise.

THank you
Venu


altenbach wrote:
> venurg@gmail.com wrote:I have 2D array (m x n). I want to read each row ...
>
> Just feed it into a FOR loop. It will autoindex and at each iteration you'll get one row until all rows are processed.
>
>
> venurg@gmail.com wrote:...and extract row elements. Then I need to compare these with previous row elements. Can anyone please guide me ?
>
>
> Do you want to compare each row with the previous row or do you want to compare element by element. What kind of comparison?
> For example, do you want to know...
>
> - ...if the current row is the same as the previous row?
>
> - ...how many elements are different?
>
> - ... if at least one element is greater than the same element in the previous row?
>
> - ...
>
> To get you started, I am attaching a small example (LabVIEW 7.0) that tells which rows are the same as the previous row.
> <img src="http://forums.ni.com/attachments/ni/170/212796/1/CompareRows.png"> Message Edited by altenbach on 10-29-2006 09:32 AM
>
>
> CompareRows.png:
> http://forums.ni.com/attachments/ni/170/212796/1/CompareRows.png
>
>
> CompareRows.vi:
> http://forums.ni.com/attachments/ni/170/212796/2/CompareRows.vi

0 Kudos
Message 3 of 4
(3,351 Views)


venurg@gmail.com wrote:
Thanks a ton for the advice Altenbach,

I have few columns, each having a meaning. In the first column I have G
code which commands tool motion. In next columns I have X, Y and Z
co-ordinate commands.

I have to access G code in each row and then see what was there in the
previous row. Also calculate the tool motion based on X,Y and Z values
from present and previous row.

I hope I was clear enough in explaining my problem.

Please advise.

THank you
Venu




I also need to do something like this and I am having problems reading the G line first and then the X Y and Z lines if any one knows how to split them up or a way to do it please share! Thanks
 
Tyler
0 Kudos
Message 4 of 4
(3,229 Views)