フィルターのクリア

Draw bar graph with non-fixed y values

1 回表示 (過去 30 日間)
Lauren Inan
Lauren Inan 2011 年 6 月 9 日
Hi,
I am trying to plot a bar graph. I tried to use the help page: http://www.mathworks.com/help/techdoc/ref/bar.html but my y values are not fixed. they varies depending on the calculations. it depends on: "int2str(nnz(bigholes) / num)" and "(int2str(nnz(L2) / num2))" which are two different y values. so, I used the command:
y = [(int2str(nnz(bigholes) / num)) (int2str(nnz(L2) / num2))]; bar(y); figure,
I got this error : Must supply Y data or X and Y data as first argument(s).
Do you have any idea about how to draw this bar graph?
Do you have any suggestion?
Best,
Lauren

回答 (2 件)

Arnaud Miege
Arnaud Miege 2011 年 6 月 9 日
int2str converts an integer into a string so your y variable is not numerical data you can plot. To check this, run:
whos y
and check the data type of y. I'm pretty sure y is a string. You can't plot a string.
Arnaud

the cyclist
the cyclist 2011 年 6 月 9 日
Agree with Arnaud that you are trying to plot a string, which will fail. Maybe you should show us what the actual data look like.

カテゴリ

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

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by