フィルターのクリア

plotting using data from a cell array

1 回表示 (過去 30 日間)
Sujan
Sujan 2014 年 9 月 22 日
編集済み: Yona 2014 年 9 月 22 日
Dear Friends,
i want to automatically draw a graph of marks of students vs their names. students names are in a cell array where as marks are in a vector array. is it possible to draw a graph straight away. Thanks in advance.

回答 (1 件)

Yona
Yona 2014 年 9 月 22 日
you can use bar and specify xlabel name.
figure
name = {'m1';'m2';'m3';'m4';'m5'};
y = [90,85,88,100,40];
bar(y)
set(gca,'xlabel',name)
  2 件のコメント
Sujan
Sujan 2014 年 9 月 22 日
Dear Yona, Thanks for your time and plotting using bar is working fine but labelling command doesn't work as you need a double array for above code to work. So Matlab gives the following error message. "Conversion to double from cell is not possible."
Yona
Yona 2014 年 9 月 22 日
編集済み: Yona 2014 年 9 月 22 日
The mark of students are in cells too? it is a number?
other question, for each student you have some marks or only one? all of them are numbers?
can you give a little example of structure you have?

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

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by