Creating 2d grid from cell array of data points

13 views (last 30 days)
Hi All, I am trying to create a 2-d grid of x and y locations for certain data points I have organized in a cell array. Each component of the cell array is an ordered pair. I want to plot each ordered pair on a grid, but I am very very new to matlab and haven't had much luck looking through the "Help" or internet searches. Literally I think this should just be some sort of scatter plot, but the command does not seed to work on my end. I feel as though this must be very easy to do. Any suggestions?
Thanks, Garrett

Accepted Answer

Andrew Newell
Andrew Newell on 19 Jul 2011
If your cell array is c, you could use
x = cell2mat(c(:));
plot(x(:,1),x(:,2),'.')
The colon operator in c(:) makes c into a column vector, so x is a matrix with 2 columns.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!