I want to set time when i plot graph (in gui)

1 回表示 (過去 30 日間)
woongki park
woongki park 2018 年 8 月 17 日
コメント済み: Walter Roberson 2018 年 8 月 18 日
when i put
09:12:45 ->Edit text 1
12:00:12 ->Edit text 2
i want to plot graph between text 1 and text 2 time
is it possible?
at first i imported data from excel

採用された回答

Walter Roberson
Walter Roberson 2018 年 8 月 17 日
If you convert to a timetable() object then you can use timerange() to subscript the entries.
If you do not use a timetable() object, then you can use standard logical masks, like
start_dur = duration( get(handles.text1, 'String') );
end_dur = duration( get(handles.text2, 'String') );
dur_column = YourArray{:,3}; %select appropriate duration column, method will vary according to how you stored your data
mask = dur_column >= start_dur & dur_column <= end_dur;
selected_data = YourArray{mask, :}; %method will vary according to how you stored your data
Now you can plot from selected_data
  13 件のコメント
woongki park
woongki park 2018 年 8 月 18 日
編集済み: woongki park 2018 年 8 月 18 日
it doesn't work.duration function still have problem. dateshift are not working with duration function
how about using datetime instead of duration
Walter Roberson
Walter Roberson 2018 年 8 月 18 日
Date1 = datetime(txt, 'InputFormat', 'hh:mm:ss', 'Format', 'hh:mm:ss');
start_dur = datetime( get(handles.text1, 'String') );
end_dur = datetime( get(handles.text2, 'String') );
Date1 = Date1 - dateshift(Date1, 'start', 'day');
start_dur = start_dur - dateshift(start_dur, 'start', 'day');
end_dur = end_dur - dateshift(end_dur, 'start', 'day');

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeDates and Time についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by