how to transfer a 3D variable into a row in an excel file?
3 views (last 30 days)
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.
ch_lables=EEG.chanlocs.labels; % I uesed this and only the first lable is shown?
I appreciate your help in advance.
Image Analyst on 9 Aug 2020
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.
More Answers (1)
Sulaymon Eshkabilov on 9 Aug 2020
a simple solution might be this one:
for ii=1:14 % EEGData has 14 layers
xlswrite('EEGData_ALL.xlsx', EEGData(:,:,ii), SH); % Note that you will have 14 seprate sheets of data