入出館のデータから滞在人数のグラフを作る方法
11 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
添付csvの入出館のデータから、滞在人数の線グラフ(横軸10分単位の時間、縦軸滞在人数)を作ることはできるでしょうか?
1日悩んだのですが、どうにも判りません。(もしかしたら出来ないのかも)
よろしくお願いいたします。
0 commentaires
Réponse acceptée
Atsushi Ueno
le 1 Juin 2023
isbetween 関数を使えば、日付と時刻の区間内の要素を判別出来ます。
data = readtable('https://jp.mathworks.com/matlabcentral/answers/uploaded_files/1399879/Book1.csv');
for k = 1:height(data) % 入退室それぞれの日付と時刻をくっ付ける(もっと上手いやり方があるはず)
data2(k,1) = datetime(strcat(string(data{k,1})," ",string(data{k,2})),'InputFormat','yyyy/MM/dd HH:mm:ss');
data2(k,2) = datetime(strcat(string(data{k,3})," ",string(data{k,4})),'InputFormat','yyyy/MM/dd HH:mm:ss');
end
number = [];
for tm = min(data2(:)):minutes(10):max(data2(:)) % 10分おきに何人居るか数える
number = [number sum(isbetween(tm,data2(:,1),data2(:,2)))];
end
stairs(min(data2(:)):minutes(10):max(data2(:)),number); % 階段状の線プロット
3 commentaires
Plus de réponses (0)
Voir également
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!