Inserting date and time variables into graphs title
Ältere Kommentare anzeigen
I have the following code:
startDate=datetime('03-Oct-2014','InputFormat','dd-MMM-yyyy');
endDate=datetime('15-Oct-2014','InputFormat','dd-MMM-yyyy');
start_end_time = endDate-startDate;
start_end_time_days = days(start_end_time);
When I try to set title on the plot like this:
Ticker = 'SPY';
title([Ticker, ' Bought in ', char(start_end_time_days), ' days before some event']);
I get an empty string: SPY Bought in days before some event
I experimented with the code removing char() and doing like:
title([Ticker, ' Bought in ', start_end_time_days, ' days before some event']);
though it didn't help either.
2 Kommentare
Jan
am 18 Okt. 2015
I do not find the command days in the documentation. What kind of variable does it reply? Please post the type and the value.
Andrei Makarskiy
am 19 Okt. 2015
Bearbeitet: Andrei Makarskiy
am 19 Okt. 2015
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu Numeric Types finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!