help-octave
[Top][All Lists]
Advanced

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

Re: plot a vector in a matrix


From: Przemek Klosowski
Subject: Re: plot a vector in a matrix
Date: Thu, 21 Jun 2018 12:15:04 -0400
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0

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 via email to

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