How to Plot a Date on the X Axis using xlsread?
显示 更早的评论
I've read in an excel file using:
>>[num,txt,raw] = xlsread(FilePath, sheet, range);
having my code in previous steps specify the FilePath, sheet, and range; they read in to the "raw" array exactly as I want them to.
What I want to do is plot a few of the "columns" from the raw array. Specifically, I want the first column to be the x-axis, with 3 other columns as lines in the y-axis. But I want the x-axis to be in some sort or date format- preferably MM-YYYY. When I plot it by using the plot toolbar on the top of the Matlab program, it gives me this code:
>> plot(cell2mat(raw(:,[17,19,end])),'DisplayName','cell2mat(raw(:,[17,19,end]))')
which plots the data exactly as I want it to, but the x-axis is not the date- it's just a number from 1-365 (I guess just the row number).
Any help or advice with this?
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Spreadsheets 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!