フィルターのクリア

Converting data contained in a cell array into a 4D matrix for input into a CNN for feature extraction

2 ビュー (過去 30 日間)
Hi All,
I am working with EMG data and trying to use a CNN to extract features from the raw signal
I currently have the latest version of Matlab 2021a
XTrain (453x1 cell array) each cell conatins a sample signal (8*213) so to clairfy that is 453 samples and each sample contains 8 channel sequence with 213 data points
From the reading i have done this needs to be converted in to a 4D matrix to be acceptable for a CNN
I thought his would work based on an example set of code i found:
XTrain = reshape(XTrain,[8,213,1,453])
but i am getting errors:
Number of elements must not change. Use [] as one of the size inputs to automatically calculate the appropriate size for that
dimension.
I am not really sure how to make this work now. I have tried using empty [] in place of some of the dimensions but this has not worked either.
Any help would be appreciated
Kind Regards

採用された回答

KSSV
KSSV 2021 年 6 月 8 日
XTrain = cat(3,XTrain{:}) ;
XTrain = reshape(XTrain,8,213,1,453) ;
  3 件のコメント
KSSV
KSSV 2021 年 6 月 8 日
% Demo with dummy data
XTrain = cell(453,1) ;
for i = 1:453
XTrain{i} = rand(8,213) ;
end
XTrain = cat(3,XTrain{:}) ;
XTrain = reshape(XTrain,8,213,1,453) ;
CHRISTOPHER MILLAR
CHRISTOPHER MILLAR 2021 年 6 月 8 日
Brilliant
Thanks alot for your help
This worked perfectly for me now

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

その他の回答 (0 件)

カテゴリ

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

製品


リリース

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by