The main goal is to randomize the columns of 3 cell arrays. The names of the cell arrays are:
names = {'PairsEMG_walk','PairsEMG_up','PairsEMG_do'};
I have created an random index array Idx of length(#columnsPairsEMG_walk+#columnsPairsEMG_up+#columnsPairsEMG_do).
Its contents are values that relates to: integer = name of array and decimal = number of column of cell array I am tying to create a new cell array concatenating the randomize data using
condition = floor(Idx); %to point to the cell array column to extract the name of my cell array
column =100*rem(Idx,1); % to pint to the column of "that" cell array
For example, I have:
Idx = [ 2.0400 3.1200 1.1600 1.0900 2.0800 2.0200 3.1400 3.0200 3.0600 3.0100 1.1200 1.0200 2.1400 3.1500 1.1000 3.1300 2.1000 1.0400 2.1500 3.0900 2.0900 3.1100 2.1200 2.0100 1.0800 3.1000 1.0100 1.1400 3.0500 3.0400 1.0300 3.0800 1.0500 1.0600 1.0700 2.0500 2.1100 2.0600 1.1300 3.0700 2.0700 3.0300 2.1300 1.1100 2.0300 1.1500];
Therefore, the first value of condition is 2 and column 4, so I have to extract column 4 from PairsEMG_up and put it in EMGInputSeries, for the next iteration, I would need to extract column 12 from PairsEMG_do, and so on.
I tried to use eval(), but I am getting an error
for i=1:length(Idx)EMGInputSeries{i}=eval([names(condition(i)),'{',column(i),'}'])end
I get: Error using eval Argument must contain a character vector.
also tried:
eval(['names(',condition(i),'){',column(i),'}'])
and I get Error: The input character is not valid in MATLAB statements or expressions.
FYI, the PairEMG arrays are 3×15 cell array, and need to extract all rows of "that" column.
Thank you,
Best Answer