How to divide column vector elements in unequal parts against a condition?

3 ビュー (過去 30 日間)
Atique Barudgar
Atique Barudgar 2019 年 11 月 28 日
コメント済み: Atique Barudgar 2019 年 11 月 28 日
I have Pressure data against 5 days(for sample)
I want Pressure for all these days in different column according to days in single matrix only?
I want code which does everything, because I have big data.
Thanks
I want all column of pressure for different days inside one matrix or variable say i.e x or y.
Is it possible because length of all pressure data for a day will be different from each other?
File attached

採用された回答

Stephan
Stephan 2019 年 11 月 28 日
編集済み: Stephan 2019 年 11 月 28 日
Due to different lengths of your daily data you should use a cell array:
A = readmatrix('New Text Document.txt');
k_min = min(unique(A(:,1)));
k_max = max(unique(A(:,1)));
x = cell(1,k_max-k_min+1);
for k = k_min:k_max
x{:,k} = A(A(:,1)==k,2);
end
Access the data of the single days by using:
x{1,2} % to look day 2
x{1,5} % day 5
  2 件のコメント
Atique Barudgar
Atique Barudgar 2019 年 11 月 28 日
Thank you very much
Atique Barudgar
Atique Barudgar 2019 年 11 月 28 日
If anybody have another method, please share.

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeInteractive Control and Callbacks についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by