How can I use data (range of ages like 70-75) without matlab calculating that array for the command "legend"?

1 回表示 (過去 30 日間)
N/A
N/A 2021 年 9 月 28 日
回答済み: Image Analyst 2021 年 9 月 28 日
I am trying to plot some data and want to use a legend. I am exporting the needed data with the command (G =) readtable(...xlsx). The first row of data are ages and the next rows data are numbers like following:
{'80 - 84'} 12 85 469 1281 .....
{'75 - 79'} 24 114 573 1406 .....
{'70 - 74'} 11 145 620 1327 .....
When I try to use the command as followed ---> legend(G(1,1)) Matlab is calculating the result of 80-84 and tells me "Array indices must be positive integers or logical values". How can I use the data in the first row without matlab is calculation it.
Thank you for you help! :)

回答 (2 件)

KSSV
KSSV 2021 年 9 月 28 日
G(1,:)
  3 件のコメント
N/A
N/A 2021 年 9 月 28 日
That does not work either :(

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


Image Analyst
Image Analyst 2021 年 9 月 28 日
Since you want the contents, not a table, you must use braces not parentheses:
legend(G{1,1});

カテゴリ

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

製品


リリース

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by