MATLAB Answers

Plot Numeric values vs Date&Time

1 view (last 30 days)
pr on 28 Jan 2015
Commented: Star Strider on 28 Jan 2015
The text files contains Date&Time and some values. Please look in the attachments. I need to plot Second column with Date&Time. I see that the plot is random not as I needed. Here is the code I wrote:
fid = fopen(filename,'r');
Data = textscan(fid,'%s %s','Headerlines',1,'delimiter','\t');
DT = datenum(Data{1});
y = cellfun(@str2double,Data{2});
datetick('x',' HH:MM');
I cannot even see the right Date and Time on x axis. How can I make it clearly visible to the users? Is there any way to display xtick vertically?

Accepted Answer

Star Strider
Star Strider on 28 Jan 2015
No attachments yet.
You can display the XTickLabel values vertically in R2014b using ordinary plot commands. In earlier versions, you have to use the text function with the 'XTick' property governing the positions of the values, then rotate them to whatever angle you need.

Sign in to comment.

More Answers (0)


No tags entered yet.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by