Invalid data argument error. Plotting date against MTD precipitation data but date format (dd-MM) is not able to be processed. How do I fix?
Show older comments
% DATA BEING USED IS INCLUDED FOR CONTEXT
clearvars
clear all
clc
% open data
dataMN=readtable('MNdatafix.csv');
dataTN=readtable('TNdatafix.csv');
dataLA=readtable('LAdatafix.csv');
% subplot 1
figure(1);
subplot(3,1,1);
plot(dataLA.DATE,dataLA.MTD_PRCP_NORMAL,'r-');
subplot(3,1,2);
plot(dataTN.DATE,dataTN.MTD_PRCP_NORMAL,'r-');
subplot(3,1,3);
plot(dataMN.DATE,dataMN.MTD_PRCP_NORMAL,'r-');
Answers (1)
Look's like you want "d-MMM" as your format instead of "dd-MM". See the following page for reference.
t = readtable("TNdatafix.csv",VariableNamingRule="preserve",TextType="string")
t.DATE = datetime(t.DATE,InputFormat="d-MMM")
Categories
Find more on Environment and Settings 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!