two dimensional num arrays

Hello,

I would need a 2x2 aray of num.

PERS num databuffer{sizebuffer,6};

I would like to be able to change a whole line in a single line of code, e.g.

databuffer{1} := [500, 148, 352, 120, 121, 024];

Error indicate that this is wrong since I did not give two indices. What can I do to change the lines of such array in a similar manner?

Thank you

(I would need a sizebuffer x 6 array of num.)

Hi

The syntax for the arrays goes like this:

PERS num databuffer{2,6}:=[[1,2,3,4,5,6],[1,2,3,4,5,6]];

So in your program code, you can use a line like this:

databuffer:=[[1,2,3,4,5,6],[1,2,3,4,5,6]];

Or if you want to set only one part of the array, you might be able to create a small procedure for that, for example like this:

PROC SetDataBuffer(num position, num array{*})

FOR i FROM 1 TO Dim(array,1) DO

databuffer{position,i}:=array{i};

ENDFOR

ENDPROC

And then you can use single line of code:

SetDataBuffer 2,[6,5,4,3,2,1];

I hope this helps you.

-Osku

yep it helps ! thanks

As I am a beginner i have doubt that, i’m using 2D array, and i’m confusion that how can i create an array for the different pallet for different component, and the operator will select any 2 component for the machine tending application.is there any simple way to do a array logic by this logic…