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

Community Tip - Stay updated on what is happening on the PTC Community by subscribing to PTC Community Announcements. X

[~,~,CG(:,1)]=unique(Y) - is it possible to do this in Mathcad?

DM_10631844
11-Garnet

[~,~,CG(:,1)]=unique(Y) - is it possible to do this in Mathcad?

This is a programming made in matlab I am interested in knowing how this would be done in mathcad more than anything [~,~,CG(:,1)]=unique(Y); this operation, is it possible to do this in mathcad?

%
CG=zeros(nod,3);
%-----------Main Coordinates------------------------------------ --------------------------------------
[~,~,CG( :,1)]=unique(Y);%index of unique values in Y
CG( :,1)=CG(:,1)-ones(assent, 1);
ngl=max(CG(:,1));
%----------Secondary Coordinates------------------------------------- --------------- --------------- --------------- ----- -
CG2=zeros(2,nod-nr);
for i=1:(nod-nr)*2
ngl=ngl+1;
CG2(i)=ngl;
final
CG(nr+1:size(CG,1),2:3)=CG2';
return

 

Translated by Andra Chirila using Google Translate on March 23rd, 2023
-----------------------------------------------------------------------------------------------

Esta es una programacion hecha en matlab me interesa saber como se haria esto en mathcad mas que todo [~,~,CG(:,1)]=unique(Y); esta operacion, es posible hacer esto en mathcad?

%
CG=ceros(nod,3);
%-----------Coordenadas Principales---------------------------------------------------- ------- ------- -------
[~,~,CG( :,1)]=único(Y);%índice de valores únicos en Y
CG( :,1)=CG(:,1)-unos(asentimiento, 1);
ngl=máx(CG(:,1));
%----------Coordenadas Secundarias---------------------------------------------------- --------------- --------------- ------
CG2=ceros(2,nod-nr);
para i=1:(nod-nr)*2
ngl=ngl+1;
CG2(i)=ngl;
final
CG(nr+1:tamaño(CG,1),2:3)=CG2';
devolver

 

 

 

 

 

 

 

 

 

ACCEPTED SOLUTION

Accepted Solutions
3 REPLIES 3

You can find answer about "unique()" function in Mathcad here:

ImagenImagen

 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 is to ordered values from 1 onwards, it seems that all 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 the unique one 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

 

Translated by Andra Chirila using Google Translate on March 27th, 2023
-----------------------------------------------------------------------------------------------

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 es a valores ordenados de sde 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

Announcements

Top Tags