How can I convert a vector of 30482x1 (it is the accumulated of 4 measurements of 17 min at 8 hz) to a matrix that has columns of 8160 data.

3 件のコメント

Matt J
Matt J 2022 年 7 月 26 日
30482 does not divide evenly into 8160,
30482/8160
ans = 3.7355
so your intended rule for reorganizing this data is not clear.
Fangjun Jiang
Fangjun Jiang 2022 年 7 月 26 日
reshape()
dpb
dpb 2022 年 7 月 26 日
On top of which, given the statement that "it is ... 4 measurements of 17 min at 8 hz)"
>> mod(30482,4)
ans =
2
>>
so the list isn't a complete set of four.

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

 採用された回答

dpb
dpb 2022 年 7 月 26 日

0 投票

Given the above problems regarding the number of elements in the vector vis a vis the number of channels (and it can't be there's a timestamp as it's also not divisible by five), the best you can do is something like
N=numel(x); % x is the data vector, determine how long it actually is
nCh=4; % the supposed number of channels/columns
M=N-mod(N,nCh); % how many nCh records there actually are
x=reshape(x(1:M),[],nCh); % keep M samples; reshape() to nCh columns
NB --
>> 8160*4
ans =
32640
>>

1 件のコメント

Andres Ulloa
Andres Ulloa 2022 年 7 月 26 日
Thank you so much!

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

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeResizing and Reshaping Matrices についてさらに検索

製品

リリース

R2015a

質問済み:

2022 年 7 月 26 日

コメント済み:

2022 年 7 月 26 日

Community Treasure Hunt

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

Start Hunting!

Translated by