フィルターのクリア

Extracting particular data from excel table

5 ビュー (過去 30 日間)
Indrani
Indrani 2023 年 6 月 14 日
コメント済み: Indrani 2023 年 6 月 15 日
I have a .csv file, which I have imported as a table in matlab. The table has freuency values for each minute of the day for the entire 24 hours. I want to analyse the data by studying each hour separately and plotting a graph for each hour. How can extract such data?
  3 件のコメント
Indrani
Indrani 2023 年 6 月 14 日
Thank you.
But how do I do it for the attached csv file?
Dyuman Joshi
Dyuman Joshi 2023 年 6 月 14 日
You can import the data by readcell and then reshape it accordingly to do analysis.
It seems like the data is for every milisecond, so 00:00.0 to 59:59.9 is an hour, and the data from B2-B36001 (i.e. 36000 miliseconds in an hour) is to be analaysed and B36002-B72001, B72002-B108001 and ..., so on.
So you can use
reshape(data,36000,[])
to get the output as data for each hour in each column. Then you can use functions on the 2nd dimension of the array to directly get result.
Also, there seems to be some missing data in the file. As the number of rows is not a multiple of 36000

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

採用された回答

Sharad
Sharad 2023 年 6 月 14 日
Hi,
In order to analyze the data by extracting and plotting the data for each hour, you can follow these steps:
  • Load the .csv file (assuming the .csv file is present in the same directory as the script).
table = readtable('2023-01-12.csv');
  • Seperate the Time and Value columns.
time = table.Time;
value = table.Value;
  • Iterate for each hour, find the set of indices satisfying the value of each hour, and plot each of them in a seperate subplot.
% Repeat for each hour
for h=0:23
subplot(4, 6, h+1);
% Extract hour wise data
idx = find(hour(time)==h);
% plot each hour data on seperate subplot
plot(value(idx));
title(sprintf('Hour %d', h));
end
  • The output will look something like this:
  3 件のコメント
Sharad
Sharad 2023 年 6 月 15 日
Thanks for the approach
Indrani
Indrani 2023 年 6 月 15 日
Thank you!

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeTables についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by