??? Error using ==> plot Invalid first data argument

filedir = dir('C:\Users\ValcourtA\Documents\WILMA\WILMA500Hz')
timerArray=[];
for cnt=1:5
battery=data(:,1)
timerArray=vertcat(timerArray,filedir(cnt).date)
plot(timerArray,Battery)
end
why do i get this error ??? Error using ==> plot Invalid first data argument

回答 (1 件)

Dishant Arora
Dishant Arora 2014 年 5 月 13 日

0 投票

filedir(cnt).date is a character string. Use datenum
datenum(filedir(cnt).date)

3 件のコメント

Mini Me
Mini Me 2014 年 5 月 13 日
編集済み: Mini Me 2014 年 5 月 13 日
problem is i want the date to show but i suse datetick which only display the date not the time...so the graph doesnt come out right because the timestamps difference is seconds between them...
i,e
05/13/14 11:00:05
05/13/14 11:00:06
Dishant Arora
Dishant Arora 2014 年 5 月 13 日
make use of dateformnum , as a parameter to datetick
datetick('x' , 0 , 'keepticks') % after you plot.
for more information see the documentation of datetick.
Mini Me
Mini Me 2014 年 5 月 13 日
not working..graph comes up as a vertical line because of how closed the dates are....

サインインしてコメントする。

カテゴリ

ヘルプ センター および File ExchangeDates and Time についてさらに検索

製品

タグ

質問済み:

2014 年 5 月 13 日

コメント済み:

2014 年 5 月 13 日

Community Treasure Hunt

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

Start Hunting!

Translated by