フィルターのクリア

Plotting a simple line graph from cell array

2 ビュー (過去 30 日間)
RDG
RDG 2012 年 9 月 1 日
Greetings, I am trying to plot a 2D-line graph from the contents of a cell array but I am not able to achieve it. A simple code is attached as below and my objective is to plot a real-time graph of the x_value against counter. Thank you in advance for your help.
for i=1:5
x_value{i}=i+1
counter=i
end

採用された回答

Image Analyst
Image Analyst 2012 年 9 月 1 日
If you can't avoid x_value being a cell array (instead of just a regular normal numerical array), then use cell2mat(). Try this:
counter = 1 : 5
for k = counter
x_value{k} = k + 1;
end
double_x = cell2mat(x_value)
plot(counter, double_x, 'bo-', 'LineWidth', 3, 'MarkerSize', 20);
grid on;
xlabel('counter', 'FontSize', 30);
ylabel('x value', 'FontSize', 30);
% Enlarge figure to full screen.
set(gcf, 'units','normalized','outerposition',[0 0 1 1]);
  1 件のコメント
RDG
RDG 2012 年 9 月 1 日
Thank you very much.

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

その他の回答 (0 件)

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by