% B = sort(A) sorts the elements of A in ascending order.
% If A is a vector, then sort(A) sorts the vector elements.
% If A is a matrix, then sort(A) treats the columns of A as vectors and sorts each column.
% MATLAB version allows Y to be a multidimensional matrix, but the Eigen version is only for 1D or 2D matrices.
%
% B = sort(A,dim) returns the sorted elements of A along dimension dim. For example, if A is a matrix, then sort(A,2) sorts the elements of each row.
%
% B = sort(___,direction) returns sorted elements of A in the order specified by direction using any of the previous syntaxes. 'ascend' indicates ascending order (the default) and 'descend' indicates descending order.
%
% B = sort(___,Name,Value) specifies additional parameters for sorting. For example, sort(A,'ComparisonMethod','abs') sorts the elements of A by magnitude.
%
%
%
% [Y,IX] = sort(Y,dim,mode)

A = 10:-1:1
sort(A)

%

B=randi([0 20], 5,2)
sort(B)

% [B,I] = sort(___) also returns a collection of index vectors for any of the previous syntaxes. I is the same size as A and describes the arrangement of the elements of A into B along the sorted dimension. For example, if A is a vector, then B = A(I).
% B lists the sorted dates and I contains the corresponding indices of A.
% Access the sorted elements from the original array directly by using the index array I.

[B,I] = sort(A)
E=randi([20 50] , 1,10)
[F,I] = sort(E)
E(I(1))

% Import Data ile Edestekten bilgiler bmmuEdestek isimli değişikene aktarılmıştır.
% Numara sütununa göre bu matrisi sıralayınız. Öğrenci ad, soyad ve numara bilgilerinin ayrı ayrı sıralanmaması gerekir.
%

[B,I] = sort(bmmuEdestek)
I(1,3)
bmmuEdestek(I(1,3),:)
bmmuSirali(1,:) = bmmuEdestek(I(1,3),:);
bmmuSirali(2,:) = bmmuEdestek(I(2,3),:);
clear bmmuSirali;
bmmuSirali(:,:) = bmmuEdestek(I(:,3),:)

%
%% Eigen Block işlemleri
% B(i:(i+w),j:(j+h)) = A(x:(x+w),y:(y+h))
% B(1:(1+5),1:(1+6)) = A(6:11,25:33)
% B = rand(5,10,3)
% B(1)
% B(1,1)
% B(end)
% B(prod(size(B)))
%

A=rand(5,4,3)
max(A)
max(A(:))

% Find the maximum coefficient over all entries of the matrix.
% min(A(:))
% eye(w,h)

eye(3)
eye(3,4)

% A(i:(i+w),j:(j+h)) = eye(w,h)
%
%
% [I,J,V] = find(X)

M = magic(5)
[I,J,V] = find(M>21)
M(I,J)
indis = find(M>21)
M([I,J])

%
% j. sütundaki tüm satır elemanlarına x ekleyip saklayın.
% X(:,j) = X(:,j) + x
% C++ Eigen kodu :
% X.col(j).array() += x
% Acol_sum = sum(A,1)
% Arow_sum = sum(A,2)
% Adim_sum = sum(Asparse,dim)
% Acol_sum = A.colwise().sum()
% Arow_sum = A.rowwise().sum()
% igl::sum(Asparse,dim,Adim_sum)
% Currently the igl version only supports sparse matrix input (and dim must be 1 or 2)
% sparse matrix - (TÜRKÇE) Seyrek matris
%
%
% Extract the main diagonal of a matrix. Currently igl version supports sparse only.
% Construct new square matrix M with entries of vector D along the diagonal. Currently igl version supports sparse only.
% TÜRKÇE
% Diyagonal boyunca D vektörünün girişleri ile yeni kare matrisi M'yi oluşturun. Şu anda igl sürümü yalnızca seyrek destekliyor.

M = magic(4)
v = diag(M)
diag(diag(M))

%
%

% M = magic(5)
%  reshape(M,[],2)

M2 = rand(4,5)
reshape(M2,2,[])

%
%
% [Y,I] = max(X,[],dim)
% M = max(A,[],dim) returns the largest elements along dimension dim. For example, if A is a matrix, then max(A,[],2) is a column vector containing the maximum value of each row.
% C = A.*B
% C = (A.array() * B.array()).matrix()
% C = A.^b
% C = A.array().pow(b).matrix()

B=[ 0 10 5 5 0 ]
C=[1 0 3 888 2]
B==0
C(B==0)
A(B == 0) = C(B==0)

% B = fliplr(A)
% B = flipud(A)
%
% any

A = [0.53 0.67 0.01 0.38 0.07 0.42 0.69];
B = A(A < 0.5)
if any(A<0.5)
    A(A<0.5)*-1
end
any(B)
D=[ 0 0 0 
    1 0 2 
    3 0 4 ]
any(D,2)