Why won't Matlab recognize my data?
Show older comments
I am trying to plot CSV data (attached) on Google search trends, but the date (year and month) is only appearing as "NaN." How do I plot this?
Accepted Answer
More Answers (1)
filename = 'https://www.mathworks.com/matlabcentral/answers/uploaded_files/965680/multiTimeline.csv';
opt = detectImportOptions(filename, 'PreserveVariableNames', true);
opt = setvartype(opt, 1, 'datetime');
opt = setvaropts(opt, 1, 'InputFormat', 'yyyy-MM');
T = readtable(filename, opt);
T(1:2,:)
2 Comments
econogist
on 15 Apr 2022
filename = 'https://www.mathworks.com/matlabcentral/answers/uploaded_files/965680/multiTimeline.csv';
opt = detectImportOptions(filename, 'PreserveVariableNames', true);
opt = setvartype(opt, 1, 'datetime');
opt = setvaropts(opt, 1, 'InputFormat', 'yyyy-MM');
T = readtable(filename, opt);
plot(T{:,1}, T{:,2})
Categories
Find more on Polar Plots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

