Creating 2d grid from cell array of data points

13 ビュー (過去 30 日間)
Garrett
Garrett 2011 年 7 月 19 日
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

採用された回答

Andrew Newell
Andrew Newell 2011 年 7 月 19 日
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.
  1 件のコメント
Garrett
Garrett 2011 年 7 月 25 日
Thanks for the help! Works great!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLogical についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by