Clear Filters
Clear Filters

How can I plot matrix locations on top of corresponding matrix elements?

1 view (last 30 days)
Hi,
I have a set of 20 matrix locations (elements) which have their subscript indices stored as "xpossav" and "ypossav". These correspond to rows and columns of a matrix, C, respectively. These "coordinates" are simulated location points of a movement trajectory. I want to plot these coordinates on top of the elements in the matrix C that the coordinates correspond to. I know that matrices are indexed (rows, columns), so equivalent plotting would be (y,x). Below is the code I have used to create a plot of the coordinates, so that I can visualize the trajectory:
plot(ypossav,(size(C,1)-xpossav),'-o'),xlabel('X'),ylabel('Y'), title('Trajectory')
This works in plotting the locations correctly. I then want to display the subset of the matrix that corresponds to the locations. For example, the point for location xpossav=1,ypossav=1 should be shown on top of element (1,1) of matrix C. Is there a way to do this? I have tried different approaches, but can only achieve to plot the locations separately from the corresponding matrix subset.
  5 Comments
dpb
dpb on 21 Jun 2017
Well, I could read them as .mat files but then not sure precisely what to try to do with them. If they're figures intended to show the way you'd like to present the data, use the 'File' and 'SaveAs' to save them as .jpg then attach the images and we can see them here.
Stephanie Diaz
Stephanie Diaz on 22 Jun 2017
Hi @dpb ,
I have attached them as image files. The "points3" files are the coordinates, the "matrix subset2" files is the part of the larger matrix that these points correspond to, and "matrix_C2" is the larger matrix. "Plot" is more of what I would like the plotting to look like, basically points overlaid on their location on a map. My map is essentially the matrix subset.

Sign in to comment.

Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!