How to input the XYZ coordinate and Quaternion data from externl file or matrix?

I am using MoveL to program the robot:

MoveL Target_20,v1000,fine,tRM62_22\WObj:=Workobject_1;

and the target_20 is :

CONST robtarget Target_20:=[[-12.830311995,192.144032798,119.012999948],[0.618084702345011,0.492475524331876,0.299763882874037,0.534397579696431],[-1,1,-3,0],[9E9,9E9,9E9,9E9,9E9,9E9]];

The first array is the XYZ coordinate and the second array is the quaternion. I am calculating both array in Matlab.

The problem is I will have huge number of points. It is time consuming to copy and paste them one by one to the Rapid program.

Is there a better way to input these points to the MoveL? For example, I can store the data in an excel file or txt file. How can Rapid read the excel or txt file? Otherwise, can I use a matrix to store all the points and read them one by one in the Rapid?

Thanks!

You can use a iodev to read from a for example a text file.

Here is just an ex. where I read a values seperated with ; The text file is stored in the home folder on the robot controller PROC ReadTest() VAR iodev testsFile; VAR string strRead; VAR num nArrayPosition; VAR bool bEmptyFile; ! nArrayPosition:=1; bEmptyFile:=FALSE; ! Open file Open “tests.txt”,testsFile\Read; WHILE bEmptyFile=FALSE DO ! Write into array strRead:=ReadStr(testsFile\Delim:=“;”\RemoveCR); IF strRead<>EOF THEN arrDefinedTests{nArrayPosition}.TestNo:=strRead; strRead:=ReadStr(testsFile\Delim:=“;”\RemoveCR); arrDefinedTests{nArrayPosition}.Chapter:=strRead; strRead:=ReadStr(testsFile\Delim:=“;”\RemoveCR); arrDefinedTests{nArrayPosition}.Description:=strRead; Incr nArrayPosition; ELSE bEmptyFile:=TRUE; ENDIF ENDWHILE ! Close file Close testsFile; ERROR Close testsFile; RAISE ; ENDPROC

Those values should be put into ‘input’. However, my input is always 0.

Could you please suggest the data type, which I should declare for ‘input’? Or how should I arrange the values in the .txt file?

Thanks!

I have figured out the problem. I need to write a loop to read the data in the file, like PerSvensson’s answer. Thanks!