cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Want the oppurtunity to discuss enhancements to PTC products? Join a working group! X

Too many operators

YA_10963798
9-Granite

Too many operators

I need to generate a function which has three values (Beta , alfa and distance )

when Beta values will be the mean operator for example when beta=0 the function will run in all alfa and distance values to find the solution

Then it goes to the second beta value=15 and do the same .....until it does for all 24 values of beta 

in my excel sheet I have 24 tables , I attached the excel and mathcad sheets

I tried to do it as follows but it didn't work ?

YA_10963798_0-1714457705976.png

YA_10963798_1-1714457876804.pngYA_10963798_2-1714457931771.png

 

 

1 ACCEPTED SOLUTION

Accepted Solutions

1) "alpha" and "Distance" are both (2-dimensional) 9 x 9 matrices.

1a) Accessing elements of such a matrix require the use of TWO indices (row and column). You are using just one index, so Prime can't possibly know which element you mean or if you mean a whole column or row.

1b) "length( )" can only be used to get the number of elements in a (1-dimensional) n x 1 matrix = column vector. For 2-dimensional matrices you can use the functions "rows( )"  and "cols( )" to get the number of rows and columns.

2) Prime does not support 3-dimensional structures so you can't use three indices like inWerner_E_0-1714471802325.png
If you really need a structure like a 9 x 24 x 9 "matrix", you could create nested matrices. Perhaps a 9 x 1 matrix (= column vector) which consists of 9 matrices with dimension 24 x 9. Or a 9 x 24 matrix where each element is a 9 x 1 vector. Depends on your needs.

3) Loops in programs are created using ranges! If you writeWerner_E_1-1714472445587.png then j takes only ONE value (in this case 24). If you want to run j from the first index (1 in your sheet) to the last (24 in case of Beta) you would have to writeWerner_E_3-1714472626452.png. Using "last" instead of "length" assures that the program also works OK if the system variable ORIGIN is set to something different than 1.

 

Not sure what exactly you are trying to create, but maybe this function can be of help:

Werner_E_4-1714472750943.png

It creates a 9x9 matrix for every of the 24 values in Beta and collect them in a 24 x 1 vector:

Werner_E_5-1714472803032.png

Showing just the first two ...

Werner_E_6-1714472909667.png

Of course you can access individual elements the usual way, here the matrix you get for Beta with index 10:

Werner_E_7-1714472974550.png

 

 

 

 

 

 

 

 

View solution in original post

3 REPLIES 3

1) "alpha" and "Distance" are both (2-dimensional) 9 x 9 matrices.

1a) Accessing elements of such a matrix require the use of TWO indices (row and column). You are using just one index, so Prime can't possibly know which element you mean or if you mean a whole column or row.

1b) "length( )" can only be used to get the number of elements in a (1-dimensional) n x 1 matrix = column vector. For 2-dimensional matrices you can use the functions "rows( )"  and "cols( )" to get the number of rows and columns.

2) Prime does not support 3-dimensional structures so you can't use three indices like inWerner_E_0-1714471802325.png
If you really need a structure like a 9 x 24 x 9 "matrix", you could create nested matrices. Perhaps a 9 x 1 matrix (= column vector) which consists of 9 matrices with dimension 24 x 9. Or a 9 x 24 matrix where each element is a 9 x 1 vector. Depends on your needs.

3) Loops in programs are created using ranges! If you writeWerner_E_1-1714472445587.png then j takes only ONE value (in this case 24). If you want to run j from the first index (1 in your sheet) to the last (24 in case of Beta) you would have to writeWerner_E_3-1714472626452.png. Using "last" instead of "length" assures that the program also works OK if the system variable ORIGIN is set to something different than 1.

 

Not sure what exactly you are trying to create, but maybe this function can be of help:

Werner_E_4-1714472750943.png

It creates a 9x9 matrix for every of the 24 values in Beta and collect them in a 24 x 1 vector:

Werner_E_5-1714472803032.png

Showing just the first two ...

Werner_E_6-1714472909667.png

Of course you can access individual elements the usual way, here the matrix you get for Beta with index 10:

Werner_E_7-1714472974550.png

 

 

 

 

 

 

 

 

Hi Werner,

I hope you are doing well. 

I need to take this sheet a step further.  Now after we get 24 matrics . I need to find the minimum value in each column in each matrix. 

For example: matrix Linters 23 will have a matrix of the minimum values of each colunm . I tried to do it as follows but couldn't get what i want since it gives me the minimum in the whole matrix . I need  the minimum in each column in each matrix.

Like in excel you select the colunum and find the minimum in that column. Sorry for bothering you a lot. But I genuinely appreciate your help

YA_10963798_0-1714921984182.png

 

 

Top Tags