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

Community Tip - Need to share some code when posting a question or reply? Make sure to use the "Insert code sample" menu option. Learn more! X

What would be the code that I should do, [~,~,CG(:,1)=unique(Y), for this unique function

DM_10631844
4-Participant

What would be the code that I should do, [~,~,CG(:,1)=unique(Y), for this unique function

Please, what would be the code that I should do, [~,~,CG(:,1)=unique(Y), the unique function was clear to me. I appreciate the answer, now the expression [~,~,CG(:,1)] It seems that it changes the ordered values from 1 onwards, it seems that all the similar values are changed by a number in repeated order as shown in the figure, in the figure there is also the value of ans, which is unique, and above the value of Y=[0,, 0, 0, 3.7, 3.7, 3.7, 7.4, 7.4, 7.4, 3.7, 7.4], using puts it in the first column as [1, 1, 1 ,2, 2, 2, 3 , 3, 3, 2,3], how would that programming be, in Mathcad prime

ImagenImagen

 

--------------------------------------------------------
Translated text from Spanish to English using google translate. Translated by vnamboodheri on 28-March-2023 at 8:51am IST
Porfavor cual seria el codigo que debo realizar, [~,~,CG(:,1)=unique(Y),la funcion unique me quedo claro agradezco la respuesta ahora la expresion [~,~,CG(:,1)] parece que cambia los valores ordenados desde 1 en adelante, parece que todo los valores smiliares los cambia por un numero en ordenrepetido tal como se muestra en la figura, en la figura tambien esta el valor de ans que es el unique y arriba el valor de Y=[0,, 0, 0, 3.7, 3.7, 3.7, 7.4, 7.4, 7.4, 3.7, 7.4], al usar lo pone en la primera columna como [1, 1, 1 ,2, 2, 2, 3, 3, 3, 2,3], como seria esa programacion, en mathcad prime
--------------------------------------------------------

 

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions

Hi

Matlab "unique" function sorts the terms in increasing order.in the result.  I have added a 5.4 out of order to show you.

Capture4.jpg

In order to get this need to add some sorting in the Prime function:

Capture3.JPG

Cheers

Terry

View solution in original post

3 REPLIES 3

Hi,

Here is one way:

Capture.JPG

Cheers

Terry

Hi

Matlab "unique" function sorts the terms in increasing order.in the result.  I have added a 5.4 out of order to show you.

Capture4.jpg

In order to get this need to add some sorting in the Prime function:

Capture3.JPG

Cheers

Terry

Muchas gracias un excelente aporte muy buena comunidad se agradece

Top Tags