Extractiong sLoreta Data from EEG: transpose on ND array is not defined, use permute instead

Hi, I am trying to extract sLoreta data from EEG data using the plug in bellow:

2 Comments

I would presume the line "g.data = EEG.data';" is the source of the error message. If so, then EEG.data has more than two dimensions and you cannot do a transpose operation on it, which is only defined for two-dimensional matrices. You will have to figure out just what it is that you want done on EEG.data. The suggestion given in the message is to use the 'permute' operation. I suggest you carefully read up on that in:
https://www.mathworks.com/help/matlab/ref/permute.html
I would say that your very first task is to determine how many dimensions EEG.data has. Insert the line
t = size(EEG.data)
after the first line of writesLORdat. The number of elements in t will tell you how many dimensions there are to EEG.data, and what the length of each one is. Assuming there are more than two, your next task, which only you can do, is to determine just what it is you wish done to the arrangement of of EEG.data in order to place it in g.data. As I say, only you can answer that question. Once you have done that perhaps some of us can tell you how to accomplish it. The error message's suggestion of using 'permute' is only a guess on the part of the Matlab people who prepare error messages, though I think it is probably a very good guess in your case. The idea behind 'permute' is to change the order of the various dimensions of an array so that, say, an array of size 3x4x5 would become one of size 5x4x3, for example - in other words, an element which formerly possessed indices of 2,1,4 would be rearranged so as to possess indices of 4,1,2. That is a generalization of what happens in the transpose of a two-dimensional array.

Sign in to comment.

 Accepted Answer

In that case what you probably need is 'reshape'.
g.data = reshape(EEG.data(61,[]);

1 Comment

Then try
g.data = reshape(EEG.data(61,[],1);
(I'm responding to your original comment that you needed a 61x3800 matrix for g.data.)

Sign in to comment.

More Answers (0)

Categories

Tags

Community Treasure Hunt

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

Start Hunting!