フィルターのクリア

Plot data from a double class array

89 ビュー (過去 30 日間)
daniel.x16
daniel.x16 2011 年 5 月 31 日
Hi,
Is there a way to plot data directly from a double array? I have my x variables in column 1, and y variables in column 2. I am writing a program to do this with a large number of plots, so I would like a way to just graph a 360 x 2 double array.
Is there any way to do this? I know I can do x=array(:,1); y=array(:,2); plot(x,y)
but I would like to just do something like plot(array)

採用された回答

Matt Fig
Matt Fig 2011 年 5 月 31 日
plot(array(:,1),array(:,2))
If you don't like that for some reason, you could do:
ac = mat2cell(array,size(array,1),[1 1]);
plot(ac{:})
  1 件のコメント
daniel.x16
daniel.x16 2011 年 5 月 31 日
Thanks!

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

その他の回答 (1 件)

Walter Roberson
Walter Roberson 2011 年 5 月 31 日
You do have to break the value up to pass it to plot(). You could write your own wrapper for plot() that did the splitting for you to save you effort.
mplot = @(array,varargin) plot(array(:,1),array(:,2),varargin{:})
then
mplot(array)
or
mplot(array,'r.')
and so on.

カテゴリ

Help Center および File Exchange2-D and 3-D Plots についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by