help-octave
[Top][All Lists]

## How to get a matrix values' indices?

 From: Mikolaj Karolczak Subject: How to get a matrix values' indices? Date: Tue, 28 Sep 2004 20:12:53 +0200

```Hello,

Suppose we have a matrix of integer values. Is there any function to get quickly
matrices of each value's indices?

e.g.

I have:
[1 2 3
1 2 2
1 1 3]

I want:
-> 1: [1 1; 2 1; 3 1; 3 2]
-> 2: [1 2; 2 2; 2 3]
-> 3: [1 3; 3 3]

Surely I can get it by checking the value for every index but for big matrices
if works slowly.

Actually I need to calculate the 'specific gravity' of each value in the matrix
- the mean values of each value's indices. Maybe there is a function to do it
yet simplier?

Rgds,
Mikolaj

-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:  http://www.octave.org
How to fund new projects:  http://www.octave.org/funding.html
Subscription information:  http://www.octave.org/archive.html
-------------------------------------------------------------

```