[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: no way for simple matrix lookup ?

From: Mike Miller
Subject: Re: no way for simple matrix lookup ?
Date: Wed, 16 Jun 2004 12:53:09 -0500 (CDT)

On Wed, 16 Jun 2004, D. Goel wrote:

The following message is a courtesy copy of an article that has been posted to gmane.comp.gnu.octave.general as well.

Mike, that doesn't work, your recipe below is the first thing I tried.

Example, A = [1 3; 2 4]
b=c=[1 2].

The answer needed is [1 4], but both of your answers below give me
[1 2 3 4].

It works like this: In your example, A(b,c) tells Octave to extract from matrix 'A' the rows given by 'b' and the colums given by 'c'. Both 'b' and 'c' equal [1,2], so Octave extracts rows 1 and 2 and columns 1 and 2 from matrix 'A'.

Now I think I understand you. You want A(1,1) and A(2,2). Strangely, I wsa trying to do that yesterday(!) and failed. I hope someone will tell you what you need to do because I also need to know.


Michael B. Miller, Ph.D.
Assistant Professor
Division of Epidemiology
and Institute of Human Genetics
University of Minnesota

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

Octave's home on the web:
How to fund new projects:
Subscription information:

reply via email to

[Prev in Thread] Current Thread [Next in Thread]