MATLAB: 1D Regression with CNN

1d cnn regression

How should I treat my input matrix and target matrix for 1D regression problem with CNN?
Suppose I have EMG signals with 760000 points (samples) and I've collected data from 8 muscles (features). So, I have a matrix 760000-by-8. My target is a matrix 760000-by-1. Imagine that I have 1 trial for each 5 persons. So, I'll have for each person a 760000-by-8 matrix.
1)
In the documentation, it says that CNN treats the input data as an image, so it expects an input like h-by-w-by-c-by-N.
In this case, should I consider my features as the number of channels or the width of my input "image"? And N should be 5?
I.e., should I rearrage my training data as 760000-by-1-by-8-by-5 or 760000-by-8-by-1-by-5? Reading the documentation e some questions about this issue, I do not fully understand how should I give my data to the trainNetwork function.
2)
Another question is about the fully connected layer after the CNN feature extractor layers. After I have my feature maps, as this is a regression problem and my target is a 760000-by-1 signal, the output size of my fully connected layer should be 760000?
I'm always having a size issue, saying that it is required a very long array and matlab would become unresponsive.
Thanks in advance

Best Answer

I skimmed through the issue - sorry if I am answering in a different direction.
You should convert the 1D data into image format as follows:
X_train = reshape(X_train', [1, 1, size(X_train,2), size(X_train,1)]);
X_train: 100 x 4 matrix meaning 100 samples x 4 features
Then you should use imageInputLayer as follows:
nFeatures = 4;
nHiddenUnits1 = 3;
nHiddenUnits2 = 3; % num of classes
nClasses = 3;
layers = [
imageInputLayer([1 1, nFeatures],"Name","imageinput") % この指定の仕方も最重要ポイント 2
fullyConnectedLayer(nHiddenUnits1,"Name","fc_1")
fullyConnectedLayer(nHiddenUnits2,"Name","fc_2")
softmaxLayer("Name","softmax")
classificationLayer("Name","classoutput")];
Hope this helps you out.