tanakakai Posted September 10, 2014 Share Posted September 10, 2014 I would like to create some matrix variables to hold certain parameters for my PMAC program. As I understand it, the format for defining a matrix is: global mymatrix(n) Where n is the number of elements in the matrix. I can't find anything in the documentation that explains how I can set the values for all elements in the variable. Is there some way I can do something like this: global mymatrix(5); mymatrix = (1,2,3,4,5) Such that mymatrix(0)=1, mymatrix(1)=2, etc? edit: Also wondering if there is a function that finds (or defines) the length of the vector so I can be sure my indexing variable does not exceed the matrix length. Something like: mymatrix.index There has to be a way that the software knows how many P variables to reserve. Is the index variable generic and overwritten each time a new matrix is created? If so I suppose I should define matrix length via another variable like: global matrixlength = 5; global mymatrix(matrixlength); Link to comment Share on other sites More sharing options...
Omron Forums Support Posted September 11, 2014 Share Posted September 11, 2014 I am just passing along this information, so hopefully this answers your question: #define matrixsize 10 global matrix(matrixsize); matrix(0)=1,2,3,4,5,6,7,8,9,10 The #define is available to use in your programs. Link to comment Share on other sites More sharing options...
tanakakai Posted September 12, 2014 Author Share Posted September 12, 2014 I am just passing along this information, so hopefully this answers your question: #define matrixsize 10 global matrix(matrixsize); matrix(0)=1,2,3,4,5,6,7,8,9,10 The #define is available to use in your programs. Thanks Gregs! Adding the '(0)' to the end in order to assign values to the matrix was not intuitive. I think this will help me move forward with my code, I appreciate it! Link to comment Share on other sites More sharing options...
Recommended Posts