MATLAB: How to transfer a 3D variable into a row in an excel file

3d structure fileimporting excel dataMATLAB

Hello all,
As shown in the attached document, I have "data"(EEG data) in the form of "numberOf_Electorrdes * numberOf_Points * rial" single variable.
How Can I write it in an excel file in one row (each row is one subject) and with as many columns as the number of electordes? I tired writetable(struct2table(EEG.data), 'data.xlsx' but I got this error "Input structure must be a scalar structure.
I have also the "lable of each electrode" and I need each number to go under the right channel.
EEGData= EEG.data;
ch_lables=EEG.chanlocs.labels; % I uesed this and only the first lable is shown?
I appreciate your help in advance.
Zahra

Best Answer

In general, you can make a row vector out of your 3-D variable like this:
rowVector = array3d(:)';
% Now write to Excel
xlswrite(filename, rowVector, sheetName, 'A1');
array3d(:) turns it into a column vector, and then the apostrophe transposes it into a row vector.