Re: plot a vector in a matrix

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Re: plot a vector in a matrix

Przemek Klosowski-7
On 06/20/2018 06:59 PM, Luca Salardi wrote:
> hi,
> i've the following matrix:
>
> https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgyazo.com%2F00f509d64fe7b81d91dabf61226048e4&data=02%7C01%7Cprzemek.klosowski%40nist.gov%7C56aa393886dc4b6c6f5e08d5d701a2b0%7C2ab5d82fd8fa4797a93e054655c61dec%7C1%7C0%7C636651324383002127&sdata=w7TYDQ6F%2FQrgrPzMheLuIIlKYWFA3WyDxbDSF5u3fm4%3D&reserved=0
>
> i want to plot raws A (as X) and raws B (as Y)
so an example of your matrix is

matrix=[1 2 3 4 5 ; 11 22 33 44 55; 111 222 333 444 555; 1111 2222 3333
4444 5555; 11111 22222 33333 44444 55555]

and I think you want to plot first two rows as x and y:

plot(matrix(1,:),matrix(2,:))

This reminds me to ask here for tips and tricks. Often, I have an x-y
data file:

1 2
2 2.1
3 2.4
4 3.1
5 2.2
6 2.3

so I read it as

a=load('mydata')

and then plot with this idiom:

plot(a(:,1),a(:,2))

Is there a shortcut for a simple plot like that? The two-column data set
is such a common use case that it would be nice if plot(a) did the same
thing as the line above, or if there was a way to load the data into
separate x and y vectors and plot them with plot(x,y). What's your shortcut?


Reply | Threaded
Open this post in threaded view
|

Re: plot a vector in a matrix

LucaLuca
hi Przemek Klosowsk


now it's okey

i've plot matrix :D

about your answer  i don't underestand...
but i need to load value from text file in a matrix...

i need to use value in matrix...

thanks






--
Sent from: http://octave.1599824.n4.nabble.com/Octave-General-f1599825.html


Reply | Threaded
Open this post in threaded view
|

Re: plot a vector in a matrix

PhilipNienhuis
In reply to this post by Przemek Klosowski-7
Przemek Klosowski-7 wrote

>
> <snip>
> This reminds me to ask here for tips and tricks. Often, I have an x-y
> data file:
>
> 1 2
> 2 2.1
> 3 2.4
> 4 3.1
> 5 2.2
> 6 2.3
>
> so I read it as
>
> a=load('mydata')
>
> and then plot with this idiom:
>
> plot(a(:,1),a(:,2))
>
> Is there a shortcut for a simple plot like that? The two-column data set
> is such a common use case that it would be nice if plot(a) did the same
> thing as the line above, or if there was a way to load the data into
> separate x and y vectors and plot them with plot(x,y). What's your
> shortcut?

In bug #47149 Lachlan A supplied a patch that goes some way. I had it
applied in my own builds for some time but it screwed up some tests in the
test suite.
Maybe you can find out why?

Philip



--
Sent from: http://octave.1599824.n4.nabble.com/Octave-General-f1599825.html