フィルターのクリア

I have a text file having 7 columns. First column is UTC time in hours. This file is having data for almost 1 month. i need to separate data day wise and save it to different day . whenever first column value is > than 0.00, a new day is starting

1 回表示 (過去 30 日間)
please suggest something. i am new to matlab

採用された回答

Akbar
Akbar 2018 年 6 月 4 日
編集済み: Akbar 2018 年 6 月 4 日
First I have imported your data to matlab using its 'import data' tool. And created a table called 'anci'. Whose size is 5003x7. Where VarName1 is the first column. This code creates a cell Array for each new day. I got a cell Array called 'days' which is of size 37. So, your dataset contains 37 days. When you click on any cell you can see data collected for that particular day. I noticed that most of the days contain about 133 records. Please accept my answer.
%if the difference between previous row and next is
%more than 22, then record the index because thats where a
%new day starts.
k=1;
for i = 2:height(anci)
if abs(anci.VarName1(i) - anci.VarName1(i-1))>22
ind(k) = i;
k=k+1;
end
end
days = cell(length(ind),1); %preallocates dimensions
days{1,:} = anci(1:ind(1)-1,:); % first day
for i = 2:length(ind) % starting from second day
%creates cell array that contains tables; each cell beginning with
%index ind(i) of table anci, ending on index ind(i+1)-1
if i ~= length(ind) %if not last pass
days{i,:} = anci(ind(i):ind(i+1)-1,:);
else
days{i,:} = anci(ind(i):end,:);
end
end
  3 件のコメント
Akbar
Akbar 2018 年 6 月 5 日
編集済み: Akbar 2018 年 6 月 5 日
Because the ind vector doesn't contain the very first row index 1, so i included it manually. And wrote like this: 1:ind(1)-1
days{1,:} = anci(1:ind(1)-1,:); % first 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