Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Finding the index of row with smallest sum of squares

Subject: Finding the index of row with smallest sum of squares

From: Sammy

Date: 19 Oct, 2012 11:29:10

Message: 1 of 2

Given the value of an arbitrary real matrix given by a driver, how do I work out the index of the row (and then colomn) the smallest sum of squares?

I have worked out that the number of rows and columns are:
[nrows, ncols]=size(A)
(Where A is the matrix)

I just need imin and jmin for the sum of the squares of the rows and colomns.

Subject: Finding the index of row with smallest sum of squares

From: Sadik

Date: 19 Oct, 2012 12:29:09

Message: 2 of 2

Hi Sammy,

% Index of row with smallest SoS
[~,imin] = min(sum(A.^2,2));
% That for column
[~,jmin] = min(sum(A.^2,1)); % or equivalently [~,jmin] = min(sum(A.^2));

Best.

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us