Time vector using stairs

2 views (last 30 days)
Diana Arvidsson
Diana Arvidsson on 5 May 2017
Answered: Peter Perkins on 8 May 2017
When I use the stairs function with a time vector I get the error message "Input arguments must be numeric.". Is it even possible to use a time vector (YYMMDD) together with the stairs function, and if so, how?
  1 Comment
Jan
Jan on 5 May 2017
Please post your code, if you want us to understand the source of the problem.

Sign in to comment.

Answers (1)

Peter Perkins
Peter Perkins on 8 May 2017
It's not clear what you have and what you're trying to do, but in R2016b and later:
>> strs = {'170101' '170102' '170103' '170104' '170105' '170106' '170107' '170108' '170109' '170110'};
>> d = datetime(strs,'InputFormat','yyMMdd')
d =
1×10 datetime array
Columns 1 through 9
01-Jan-2017 02-Jan-2017 03-Jan-2017 04-Jan-2017 05-Jan-2017 06-Jan-2017 07-Jan-2017 08-Jan-2017 09-Jan-2017
Column 10
10-Jan-2017
>> stairs(d,1:10)

Categories

Find more on Language Fundamentals 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!