Unable to plot column of data that is not numerical ("Input arguments must be numeric, datetime or duration.")
5 ビュー (過去 30 日間)
古いコメントを表示
I've been using this car evaluation dataset and I am wanting to create a bar graph of only ONE column.
I've been able to successfully sort the data into tables by renaming the 'car.data' file to 'car.data'txt' and using 'readtables' to import the data.
I've also isolated each column into their own variables so I can try and create graphs with them.
However I keep getting the "Input arguments must be numeric, datetime or duration." error.
steps:
x = readtable('car.data.txt');
x.Properties.VariableNames = {'buying_price' 'maintanence_price' 'doors' 'persons' 'boot_size' 'safety_level' 'acceptability'}
buying = x(:,1)
bar(buying);
Error using bar (line 98)
Input arguments must be numeric, datetime or duration.
Where have I gone wrong?
Thanks
0 件のコメント
採用された回答
Peter Perkins
2018 年 4 月 4 日
It looks like that variable is categorical, but has been read in as text. You probably want to convert to a categorical variable and use histogram.
0 件のコメント
その他の回答 (1 件)
Walter Roberson
2018 年 4 月 3 日
buying = x.buying_price;
or
buying = x{:,1};
4 件のコメント
Walter Roberson
2018 年 4 月 4 日
I suspect that your first column has some text in part of it and was read in as characters
参考
カテゴリ
Help Center および File Exchange で Discrete Data Plots についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!