# Re: plot a vector in a matrix

3 messages
Open this post in threaded view
|

## Re: plot a vector in a matrix

 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?