Unable to plot column of data that is not numerical ("Input arguments must be numeric, datetime or duration.")
Mostra commenti meno recenti
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
Risposta accettata
Più risposte (1)
Walter Roberson
il 3 Apr 2018
buying = x.buying_price;
or
buying = x{:,1};
4 Commenti
mustard26
il 4 Apr 2018
Walter Roberson
il 4 Apr 2018
Please show
class(x.buying_price)
mustard26
il 4 Apr 2018
Walter Roberson
il 4 Apr 2018
I suspect that your first column has some text in part of it and was read in as characters
Categorie
Scopri di più su Bar Plots in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!