Table of Contents

- Assign the same matrix to all elements of a struct array
- Multiply a 3d matrix with a vector to get a 2d matrix
- Concatenate a cell array of matrices to one 3d matrix
- Find a Row in Another Matrix
- Preallocate a Cell Array of Full Matrices and Sparse Matrices
- Set the value at many (row,column) index pairs in a matrix
- Create new matrix B where each column in A is repeated k times:
- Delete All-Zero Columns or Rows
- Find n smallest values in a matrix and return their indices
- Normalize rows of matrix to sum to 1
- Normalize each row or column to length one
- To free forgotten file handle locks
- Read in text file
- Plot figure to a printable pdf of correct size
- cell2str
- Speed
- Frequently compare times of different functions
- Simple Parallelization
- Good Optimization Package
- General Matlab Speed-up Packages
- Plot a tree with labels on each node
- Convenient File Reading
- Read in Sparse Index:Value matrix
- Convenient Text File Writing of Matrices and String Cells
- Extract Sentences from a Wall Street Journal tree file
- Find out how many matlab licenses are being used.
- Saving Only a Matrix to PNG File
- Saving an image from imshow without a white/grey background
- Fast Word to Number Mapping with Java Map Containers
- Find all dependencies of a function
- Visualizing a Bivariate Gaussian Distribution
- Sort a cell array based on the length of each cell
- Element-wise max of all elements in a matrix
- Subassign a smaller matrix into a larger matrix at a range of indices
- Compute the Probability of a Point being an outlier
- Comments, Suggestions
- ~Joshuabeife — [-18 April 2018, 16:32-]
- ~Joshuabeife — [-18 April 2018, 16:32-]
- ~Joshuabeife — [-18 April 2018, 16:32-]
- ~Allenestowl — [-13 March 2018, 17:15-]
- ~Allenestowl — [-13 March 2018, 17:15-]
- ~Allenestowl — [-13 March 2018, 17:15-]
- ~Bettyric — [-27 February 2018, 23:49-]
- ~Bettyric — [-27 February 2018, 23:49-]
- ~Bettyric — [-27 February 2018, 23:49-]

Assign the same matrix to all elements of a struct array

Multiply a 3d matrix with a vector to get a 2d matrix

Concatenate a cell array of matrices to one 3d matrix

Find a Row in Another Matrix

Preallocate a Cell Array of Full Matrices and Sparse Matrices

Set the value at many (row,column) index pairs in a matrix

Create new matrix B where each column in A is repeated k times:

Delete All-Zero Columns or Rows

Find n smallest values in a matrix and return their indices

Normalize rows of matrix to sum to 1

Normalize each row or column to length one

To free forgotten file handle locks

Read in text file

Plot figure to a printable pdf of correct size

cell2str

Speed

Frequently compare times of different functions

Simple Parallelization

Good Optimization Package

General Matlab Speed-up Packages

Plot a tree with labels on each node

Convenient File Reading

Read in Sparse Index:Value matrix

Convenient Text File Writing of Matrices and String Cells

Extract Sentences from a Wall Street Journal tree file

Find out how many matlab licenses are being used.

Saving Only a Matrix to PNG File

Saving an image from imshow without a white/grey background

Fast Word to Number Mapping with Java Map Containers

Find all dependencies of a function

Visualizing a Bivariate Gaussian Distribution

Sort a cell array based on the length of each cell

Element-wise max of all elements in a matrix

Subassign a smaller matrix into a larger matrix at a range of indices

% example subMatrix
smiley = zeros(5,5);
smileyPos = [4,1;5 2; 5 3;5 4;4 5;2 2; 2 4]
for p = 1:size(smileyPos,1)
    smiley(smileyPos(p,1),smileyPos(p,2)) = 1;
end

% full image
fullImg = zeros(15,15);

% range of positions where subMatrix should be:
r1 = [1:5];
r2 = [11:15];

% example call of function
fullImg = assignSubMatrix(smiley,r1,r2,fullImg);


function fullMatrix = assignSubMatrix(subMatrix,indexBlock1,indexBlock2,fullMatrix)
% Richard at Socher.org

subMatrix=subMatrix' ;

X = indexBlock1(ceil([1:length(indexBlock1)*length(indexBlock2)]/length(indexBlock2)));
Y = repmat(indexBlock2(:), [1 length(indexBlock1)]);
setProd = [X(:) Y(:)];

fullMatrix(sub2ind(size(fullMatrix),setProd(:,1),setProd(:,2))) = subMatrix(:);
 

Compute the Probability of a Point being an outlier

%loOP_script

% use this many points to define the neighborhood
kNN = 50;

lambda = 3;

% needs slmetric_pw
addpath(genpath('slmetric_pw'))

load('ex8data1.mat');

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%  Compute Local Outlier Probabilities  %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% for data points X (trained mapped images later)
% each point is one row of this matrix

%compute all nearest neighbors
allDist = slmetric_pw(X',X','eucdist');

%first row are just the points, then follow the nearest neighbors
[allPointsNNDistances allPointsNN] = sort(allDist);

S = allPointsNN(2:kNN+1,:);
Sdist = allPointsNNDistances(2:kNN+1,:);

sigma = sqrt(sum(allPointsNNDistances.^2)./kNN);

pdist = lambda * sigma;

% expected value: E_{s\in S(o)}[pdist(s,S(s))]
Epdist = mean(pdist(S));

plof = pdist./Epdist -1;

nplof = lambda * sqrt(mean(plof.^2));

loop = erf(plof./(nplof * sqrt(2)));
loop(loop<0) = 0;


% outlier threshold:
outliers = loop>0.7;

%  Visualize the example dataset
fprintf('Visualizing example dataset for outlier detection.\n\n');
hold on
plot(X(:, 1), X(:, 2), 'bx');
axis([0 30 0 30]);

plot(X(outliers, 1), X(outliers, 2), 'ro', 'LineWidth', 2, 'MarkerSize', 10);
hold off
 

Comments, Suggestions

Add Comment 
Sign as Author 
Enter code:

Joshuabeife?18 April 2018, 16:32

We are excited to tell you about the WEBPILOT franchise opportunity! We offer our franchisees an outstanding IT franchise opportunity that allows you to meet the communication needs of businesses in your area. You can learn from our experience to build a strong business.

We propose to open your own business (web studio) IT franchise in your country or city. We offer trainings and all the materials you need for an immediate start.

Email: seorayua@gmail.com Whatsapp: +79063121620

Joshuabeife?18 April 2018, 16:32

We are excited to tell you about the WEBPILOT franchise opportunity! We offer our franchisees an outstanding IT franchise opportunity that allows you to meet the communication needs of businesses in your area. You can learn from our experience to build a strong business.

We propose to open your own business (web studio) IT franchise in your country or city. We offer trainings and all the materials you need for an immediate start.

Email: seorayua@gmail.com Whatsapp: +79063121620

Joshuabeife?18 April 2018, 16:32

We are excited to tell you about the WEBPILOT franchise opportunity! We offer our franchisees an outstanding IT franchise opportunity that allows you to meet the communication needs of businesses in your area. You can learn from our experience to build a strong business.

We propose to open your own business (web studio) IT franchise in your country or city. We offer trainings and all the materials you need for an immediate start.

Email: seorayua@gmail.com Whatsapp: +79063121620

Allenestowl?13 March 2018, 17:15

Our goal to provide you with excellent teaching of beauty services, help in achieving your goals, and undivided attention you deserve. Our experienced, professional educational staffs, assist and instruct the students in the use of the latest technologies. Each and every students have extensive training and truly loves this industry. We love nothing more than helping you to realize how great your experience at our learning institute can be. All courses are fully accredited by the KHDA, Dubai, UAE.

GLAM CREATIVE is a representative of exclusive professional products of the beauty industry in Middle East We invite to cooperation trainers and founders of professional brand with expert products and treatments.

Allenestowl?13 March 2018, 17:15

Our goal to provide you with excellent teaching of beauty services, help in achieving your goals, and undivided attention you deserve. Our experienced, professional educational staffs, assist and instruct the students in the use of the latest technologies. Each and every students have extensive training and truly loves this industry. We love nothing more than helping you to realize how great your experience at our learning institute can be. All courses are fully accredited by the KHDA, Dubai, UAE.

GLAM CREATIVE is a representative of exclusive professional products of the beauty industry in Middle East We invite to cooperation trainers and founders of professional brand with expert products and treatments.

Allenestowl?13 March 2018, 17:15

Our goal to provide you with excellent teaching of beauty services, help in achieving your goals, and undivided attention you deserve. Our experienced, professional educational staffs, assist and instruct the students in the use of the latest technologies. Each and every students have extensive training and truly loves this industry. We love nothing more than helping you to realize how great your experience at our learning institute can be. All courses are fully accredited by the KHDA, Dubai, UAE.

GLAM CREATIVE is a representative of exclusive professional products of the beauty industry in Middle East We invite to cooperation trainers and founders of professional brand with expert products and treatments.

Bettyric?27 February 2018, 23:49

Massage

Body procedures intended to make your skin perfect, to tone up and detoxify your whole body, to calm down your negative emotions and feel relaxed.

fitness in jumeirah Body Contouring

It includes procedures that eliminate or reduce excess skin and fat that remains after previously obese individuals have lost a significant amount of weight

medical massage dubai LPG treatment Non-surgical lifting and firming treatment procedure, which smoothers wrinkles and fine lines, improves under eye bags and circles, firm the skin.

Anti-age Body Treatment Anti aging therapy drastically improves capacity of physical activities, hair quality, rental function, loss of itch etc.

Micronized Agle Body Wrapping Treat A 90-minute treatment with luminaria, horsetail and spirulina, a natural amino acid that firm a tissue with vitamins a & e and tones the skin.

Art Of Beauty Slimming Treat A tailored package "Art Of Beauty Slimming Treat" including 90-minutes session each - body scrub, apparatus or manual slimming technique & body wrap.

Bettyric?27 February 2018, 23:49

Massage

Body procedures intended to make your skin perfect, to tone up and detoxify your whole body, to calm down your negative emotions and feel relaxed.

fitness in jumeirah Body Contouring

It includes procedures that eliminate or reduce excess skin and fat that remains after previously obese individuals have lost a significant amount of weight

medical massage dubai LPG treatment Non-surgical lifting and firming treatment procedure, which smoothers wrinkles and fine lines, improves under eye bags and circles, firm the skin.

Anti-age Body Treatment Anti aging therapy drastically improves capacity of physical activities, hair quality, rental function, loss of itch etc.

Micronized Agle Body Wrapping Treat A 90-minute treatment with luminaria, horsetail and spirulina, a natural amino acid that firm a tissue with vitamins a & e and tones the skin.

Art Of Beauty Slimming Treat A tailored package "Art Of Beauty Slimming Treat" including 90-minutes session each - body scrub, apparatus or manual slimming technique & body wrap.

Bettyric?27 February 2018, 23:49

Massage

Body procedures intended to make your skin perfect, to tone up and detoxify your whole body, to calm down your negative emotions and feel relaxed.

fitness in jumeirah Body Contouring

It includes procedures that eliminate or reduce excess skin and fat that remains after previously obese individuals have lost a significant amount of weight

medical massage dubai LPG treatment Non-surgical lifting and firming treatment procedure, which smoothers wrinkles and fine lines, improves under eye bags and circles, firm the skin.

Anti-age Body Treatment Anti aging therapy drastically improves capacity of physical activities, hair quality, rental function, loss of itch etc.

Micronized Agle Body Wrapping Treat A 90-minute treatment with luminaria, horsetail and spirulina, a natural amino acid that firm a tissue with vitamins a & e and tones the skin.

Art Of Beauty Slimming Treat A tailored package "Art Of Beauty Slimming Treat" including 90-minutes session each - body scrub, apparatus or manual slimming technique & body wrap.