[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: extracting data from matrix
From: |
Allen.Windhorn |
Subject: |
RE: extracting data from matrix |
Date: |
Tue, 7 May 2013 13:38:13 +0000 |
> -----Original Message-----
> From: address@hidden [mailto:help-octave-
>
> I have the following problem:
> I receive from the simulation matrix like this:
>
> 1 0,65
> 2 0,49
> 3 0,35
> 4 0,74
> 5 0,62
> 6 0,85
> 7 0,27
>
> I would like to know how to extract the data from the second column
> corresponding to the following values from the first column [1, 2, 4,
> 7] in the form of a vector.
octave:8> output = [1 0.65
2 0.49
3 0.35
4 0.74
5 0.62
6 0.85
7 0.27]
output =
1.00000 0.65000
2.00000 0.49000
3.00000 0.35000
4.00000 0.74000
5.00000 0.62000
6.00000 0.85000
7.00000 0.27000
octave:9> index = [1 2 4 7]
index =
1 2 4 7
octave:10> output(index,2)
ans =
0.65000
0.49000
0.74000
0.27000
Hope this is helpful.
Regards,
Allen