You are now following this question
- You will see updates in your followed content feed.
- You may receive emails, depending on your communication preferences.
unpack cell array of letters to be plugged into individual-cell rows, in a vector
3 views (last 30 days)
Show older comments
Dear Matlab,
I have a cell array of letters in each cell (they are channel labels), attached herein.
Eventually, I want to 'unpack' the string contents of each cell, and list them, in their own separate cell, splayed out as a row vector at the end of this below for-loop
(because in the end my GOAL is the have a list of channel locations on each experiment subject, with each subject on its own row)
(can even ignore the 1st 4 columns in the 'infon2' variable, and just make C as its own row, if easier). Hopefully this makes sense. Pls lmk if not.
as always, thanks much in advance for your help!!
Joanne
for k = 1:length(setl) % 'setl' is a list of file names for each subject
setlist = setl(k); %MAYBE CANT INDEX INTO A STRUCT
srate = num2str(200);
length1 = 2000;
ref = 3;
% initialize matrices on 1st subject
if k == 1
infon2 = strings([ length({setl.name}) 5 ]);
end % end initialization loop
infon2(k,:,:,:,:) = {num2str(k); srate; length1; ref; [c{:}]}';
close all;
end
4 Comments
Matt J
on 21 Jun 2023
Hopefully this makes sense. Pls lmk if not.
No, not to me. An example would be advisable.
Accepted Answer
Matt J
on 22 Jun 2023
load infon2
c=infon2(:,end);
L=max(cellfun(@numel,c));
for i=1:numel(c)
c{i}(end+1:L)="";
end
c=num2cell(vertcat(c{:}));
infon2=[infon2(:,1:end-1) , c]
infon2 = 240×47 cell array
Columns 1 through 13
{'1' } {'200' } {'150.995'} {'common'} {["Fp1-Ref"]} {["Fp2-Ref"]} {["F3-Ref"]} {["F4-Ref"]} {["C3-Ref"]} {["C4-Ref"]} {["P3-Ref"]} {["P4-Ref"]} {["O1-Ref"]}
{'2' } {'200' } {'96.995' } {'common'} {["Fp1-Ref"]} {["Fp2-Ref"]} {["F3-Ref"]} {["F4-Ref"]} {["C3-Ref"]} {["C4-Ref"]} {["P3-Ref"]} {["P4-Ref"]} {["O1-Ref"]}
{'3' } {'200' } {'219.995'} {'common'} {["Fp1-Ref"]} {["Fp2-Ref"]} {["F3-Ref"]} {["F4-Ref"]} {["C3-Ref"]} {["C4-Ref"]} {["P3-Ref"]} {["P4-Ref"]} {["O1-Ref"]}
{'4' } {'200' } {'68.995' } {'common'} {["Fp1-Ref"]} {["Fp2-Ref"]} {["F3-Ref"]} {["F4-Ref"]} {["C3-Ref"]} {["C4-Ref"]} {["P3-Ref"]} {["P4-Ref"]} {["O1-Ref"]}
{'5' } {'200' } {'289.995'} {'common'} {["Fp1-Ref"]} {["Fp2-Ref"]} {["F3-Ref"]} {["F4-Ref"]} {["C3-Ref"]} {["C4-Ref"]} {["P3-Ref"]} {["P4-Ref"]} {["O1-Ref"]}
{'6' } {'200' } {'824.995'} {'common'} {["Fp1-Ref"]} {["Fp2-Ref"]} {["F3-Ref"]} {["F4-Ref"]} {["C3-Ref"]} {["C4-Ref"]} {["P3-Ref"]} {["P4-Ref"]} {["O1-Ref"]}
{'7' } {'200' } {'218.995'} {'common'} {["Fp1-Ref"]} {["Fp2-Ref"]} {["F3-Ref"]} {["F4-Ref"]} {["C3-Ref"]} {["C4-Ref"]} {["P3-Ref"]} {["P4-Ref"]} {["O1-Ref"]}
{'8' } {'200' } {'217.995'} {'common'} {["Fp1-Ref"]} {["Fp2-Ref"]} {["F3-Ref"]} {["F4-Ref"]} {["C3-Ref"]} {["C4-Ref"]} {["P3-Ref"]} {["P4-Ref"]} {["O1-Ref"]}
{'9' } {'200' } {'58.995' } {'common'} {["Fp1-Ref"]} {["Fp2-Ref"]} {["F3-Ref"]} {["F4-Ref"]} {["C3-Ref"]} {["C4-Ref"]} {["P3-Ref"]} {["P4-Ref"]} {["O1-Ref"]}
{'10'} {'200' } {'57.995' } {'common'} {["Fp1-Ref"]} {["Fp2-Ref"]} {["F3-Ref"]} {["F4-Ref"]} {["C3-Ref"]} {["C4-Ref"]} {["P3-Ref"]} {["P4-Ref"]} {["O1-Ref"]}
{'11'} {'200' } {'43.995' } {'common'} {["Fp1-Ref"]} {["Fp2-Ref"]} {["F3-Ref"]} {["F4-Ref"]} {["C3-Ref"]} {["C4-Ref"]} {["P3-Ref"]} {["P4-Ref"]} {["O1-Ref"]}
{'12'} {'1000'} {'41.579' } {'common'} {["Fp1-Ref"]} {["Fp2-Ref"]} {["F3-Ref"]} {["F4-Ref"]} {["C3-Ref"]} {["C4-Ref"]} {["P3-Ref"]} {["P4-Ref"]} {["O1-Ref"]}
{'13'} {'200' } {'248.995'} {'common'} {["Fp1-Ref"]} {["Fp2-Ref"]} {["F3-Ref"]} {["F4-Ref"]} {["C3-Ref"]} {["C4-Ref"]} {["P3-Ref"]} {["P4-Ref"]} {["O1-Ref"]}
{'14'} {'200' } {'319.995'} {'common'} {["Fp1-Ref"]} {["Fp2-Ref"]} {["F3-Ref"]} {["F4-Ref"]} {["C3-Ref"]} {["C4-Ref"]} {["P3-Ref"]} {["P4-Ref"]} {["O1-Ref"]}
{'15'} {'200' } {'109.995'} {'common'} {["Fp1-Ref"]} {["Fp2-Ref"]} {["F3-Ref"]} {["F4-Ref"]} {["C3-Ref"]} {["C4-Ref"]} {["P3-Ref"]} {["P4-Ref"]} {["O1-Ref"]}
{'16'} {'200' } {'89.995' } {'common'} {["Fp1-Ref"]} {["Fp2-Ref"]} {["F3-Ref"]} {["F4-Ref"]} {["C3-Ref"]} {["C4-Ref"]} {["P3-Ref"]} {["P4-Ref"]} {["O1-Ref"]}
Columns 14 through 25
{["O2-Ref"]} {["F7-Ref"]} {["F8-Ref"]} {["T3-Ref"]} {["T4-Ref"]} {["T5-Ref"]} {["T6-Ref"]} {["Fz-Ref"]} {["Cz-Ref"]} {["Pz-Ref"]} {["POL E"]} {["POL PG1"]}
{["O2-Ref"]} {["F7-Ref"]} {["F8-Ref"]} {["T3-Ref"]} {["T4-Ref"]} {["T5-Ref"]} {["T6-Ref"]} {["Fz-Ref"]} {["Cz-Ref"]} {["Pz-Ref"]} {["POL E"]} {["POL PG1"]}
{["O2-Ref"]} {["F7-Ref"]} {["F8-Ref"]} {["T3-Ref"]} {["T4-Ref"]} {["T5-Ref"]} {["T6-Ref"]} {["Fz-Ref"]} {["Cz-Ref"]} {["Pz-Ref"]} {["POL E"]} {["POL PG1"]}
{["O2-Ref"]} {["F7-Ref"]} {["F8-Ref"]} {["T3-Ref"]} {["T4-Ref"]} {["T5-Ref"]} {["T6-Ref"]} {["Fz-Ref"]} {["Cz-Ref"]} {["Pz-Ref"]} {["POL E"]} {["POL PG1"]}
{["O2-Ref"]} {["F7-Ref"]} {["F8-Ref"]} {["T3-Ref"]} {["T4-Ref"]} {["T5-Ref"]} {["T6-Ref"]} {["Fz-Ref"]} {["Cz-Ref"]} {["Pz-Ref"]} {["POL E"]} {["POL PG1"]}
{["O2-Ref"]} {["F7-Ref"]} {["F8-Ref"]} {["T3-Ref"]} {["T4-Ref"]} {["T5-Ref"]} {["T6-Ref"]} {["Fz-Ref"]} {["Cz-Ref"]} {["Pz-Ref"]} {["POL E"]} {["POL PG1"]}
{["O2-Ref"]} {["F7-Ref"]} {["F8-Ref"]} {["T3-Ref"]} {["T4-Ref"]} {["T5-Ref"]} {["T6-Ref"]} {["Fz-Ref"]} {["Cz-Ref"]} {["Pz-Ref"]} {["POL E"]} {["POL PG1"]}
{["O2-Ref"]} {["F7-Ref"]} {["F8-Ref"]} {["T3-Ref"]} {["T4-Ref"]} {["T5-Ref"]} {["T6-Ref"]} {["Fz-Ref"]} {["Cz-Ref"]} {["Pz-Ref"]} {["POL E"]} {["POL PG1"]}
{["O2-Ref"]} {["F7-Ref"]} {["F8-Ref"]} {["T3-Ref"]} {["T4-Ref"]} {["T5-Ref"]} {["T6-Ref"]} {["Fz-Ref"]} {["Cz-Ref"]} {["Pz-Ref"]} {["POL E"]} {["POL PG1"]}
{["O2-Ref"]} {["F7-Ref"]} {["F8-Ref"]} {["T3-Ref"]} {["T4-Ref"]} {["T5-Ref"]} {["T6-Ref"]} {["Fz-Ref"]} {["Cz-Ref"]} {["Pz-Ref"]} {["POL E"]} {["POL PG1"]}
{["O2-Ref"]} {["F7-Ref"]} {["F8-Ref"]} {["T3-Ref"]} {["T4-Ref"]} {["T5-Ref"]} {["T6-Ref"]} {["Fz-Ref"]} {["Cz-Ref"]} {["Pz-Ref"]} {["POL E"]} {["POL PG1"]}
{["O2-Ref"]} {["F7-Ref"]} {["F8-Ref"]} {["T3-Ref"]} {["T4-Ref"]} {["T5-Ref"]} {["T6-Ref"]} {["Fz-Ref"]} {["Cz-Ref"]} {["Pz-Ref"]} {["POL E"]} {["POL PG1"]}
{["O2-Ref"]} {["F7-Ref"]} {["F8-Ref"]} {["T3-Ref"]} {["T4-Ref"]} {["T5-Ref"]} {["T6-Ref"]} {["Fz-Ref"]} {["Cz-Ref"]} {["Pz-Ref"]} {["POL E"]} {["POL PG1"]}
{["O2-Ref"]} {["F7-Ref"]} {["F8-Ref"]} {["T3-Ref"]} {["T4-Ref"]} {["T5-Ref"]} {["T6-Ref"]} {["Fz-Ref"]} {["Cz-Ref"]} {["Pz-Ref"]} {["POL E"]} {["POL PG1"]}
{["O2-Ref"]} {["F7-Ref"]} {["F8-Ref"]} {["T3-Ref"]} {["T4-Ref"]} {["T5-Ref"]} {["T6-Ref"]} {["Fz-Ref"]} {["Cz-Ref"]} {["Pz-Ref"]} {["POL E"]} {["POL PG1"]}
{["O2-Ref"]} {["F7-Ref"]} {["F8-Ref"]} {["T3-Ref"]} {["T4-Ref"]} {["T5-Ref"]} {["T6-Ref"]} {["Fz-Ref"]} {["Cz-Ref"]} {["Pz-Ref"]} {["POL E"]} {["POL PG1"]}
Columns 26 through 36
{["POL PG2"]} {["A1-Ref"]} {["A2-Ref"]} {["POL T1"]} {["POL T2"]} {["POL X1"]} {["POL X2"]} {["POL DC01"]} {["POL DC02"]} {["POL DC03"]} {["POL $A1" ]}
{["POL PG2"]} {["A1-Ref"]} {["A2-Ref"]} {["POL T1"]} {["POL T2"]} {["POL X1"]} {["POL X2"]} {["POL DC01"]} {["POL DC02"]} {["POL DC03"]} {["POL $A1" ]}
{["POL PG2"]} {["A1-Ref"]} {["A2-Ref"]} {["POL T1"]} {["POL T2"]} {["POL X1"]} {["POL X2"]} {["POL X3" ]} {["POL X4" ]} {["POL DC01"]} {["POL DC02"]}
{["POL PG2"]} {["A1-Ref"]} {["A2-Ref"]} {["POL T1"]} {["POL T2"]} {["POL X1"]} {["POL X2"]} {["POL X3" ]} {["POL X4" ]} {["POL DC01"]} {["POL DC02"]}
{["POL PG2"]} {["A1-Ref"]} {["A2-Ref"]} {["POL T1"]} {["POL T2"]} {["POL X1"]} {["POL X2"]} {["POL DC01"]} {["POL DC02"]} {["POL DC03"]} {["POL $A1" ]}
{["POL PG2"]} {["A1-Ref"]} {["A2-Ref"]} {["POL T1"]} {["POL T2"]} {["POL X1"]} {["POL X2"]} {["POL DC01"]} {["POL DC02"]} {["POL DC03"]} {["POL $A1" ]}
{["POL PG2"]} {["A1-Ref"]} {["A2-Ref"]} {["POL T1"]} {["POL T2"]} {["POL X1"]} {["POL X2"]} {["POL DC01"]} {["POL DC02"]} {["POL DC03"]} {["POL $A1" ]}
{["POL PG2"]} {["A1-Ref"]} {["A2-Ref"]} {["POL T1"]} {["POL T2"]} {["POL X1"]} {["POL X2"]} {["POL X3" ]} {["POL X4" ]} {["POL DC01"]} {["POL DC02"]}
{["POL PG2"]} {["A1-Ref"]} {["A2-Ref"]} {["POL T1"]} {["POL T2"]} {["POL X1"]} {["POL X2"]} {["POL X3" ]} {["POL X4" ]} {["POL DC01"]} {["POL DC02"]}
{["POL PG2"]} {["A1-Ref"]} {["A2-Ref"]} {["POL T1"]} {["POL T2"]} {["POL X1"]} {["POL X2"]} {["POL X3" ]} {["POL X4" ]} {["POL DC01"]} {["POL DC02"]}
{["POL PG2"]} {["A1-Ref"]} {["A2-Ref"]} {["POL T1"]} {["POL T2"]} {["POL X1"]} {["POL X2"]} {["POL X3" ]} {["POL X4" ]} {["POL DC01"]} {["POL DC02"]}
{["POL PG2"]} {["A1-Ref"]} {["A2-Ref"]} {["POL T1"]} {["POL T2"]} {["POL X1"]} {["POL X2"]} {["POL $A1" ]} {["POL $A2" ]} {["" ]} {["" ]}
{["POL PG2"]} {["A1-Ref"]} {["A2-Ref"]} {["POL T1"]} {["POL T2"]} {["POL X1"]} {["POL X2"]} {["POL $A1" ]} {["POL $A2" ]} {["" ]} {["" ]}
{["POL PG2"]} {["A1-Ref"]} {["A2-Ref"]} {["POL T1"]} {["POL T2"]} {["POL X1"]} {["POL X2"]} {["POL $A1" ]} {["POL $A2" ]} {["" ]} {["" ]}
{["POL PG2"]} {["A1-Ref"]} {["A2-Ref"]} {["POL T1"]} {["POL T2"]} {["POL X1"]} {["POL X2"]} {["POL $A1" ]} {["POL $A2" ]} {["" ]} {["" ]}
{["POL PG2"]} {["A1-Ref"]} {["A2-Ref"]} {["POL T1"]} {["POL T2"]} {["POL X1"]} {["POL X2"]} {["POL $A1" ]} {["POL $A2" ]} {["" ]} {["" ]}
Columns 37 through 47
{["POL $A2" ]} {["" ]} {["" ]} {["" ]} {[""]} {[""]} {[""]} {[""]} {[""]} {[""]} {[""]}
{["POL $A2" ]} {["" ]} {["" ]} {["" ]} {[""]} {[""]} {[""]} {[""]} {[""]} {[""]} {[""]}
{["POL DC03"]} {["POL DC04"]} {["POL $A1"]} {["POL $A2"]} {[""]} {[""]} {[""]} {[""]} {[""]} {[""]} {[""]}
{["POL DC03"]} {["POL DC04"]} {["POL $A1"]} {["POL $A2"]} {[""]} {[""]} {[""]} {[""]} {[""]} {[""]} {[""]}
{["POL $A2" ]} {["" ]} {["" ]} {["" ]} {[""]} {[""]} {[""]} {[""]} {[""]} {[""]} {[""]}
{["POL $A2" ]} {["" ]} {["" ]} {["" ]} {[""]} {[""]} {[""]} {[""]} {[""]} {[""]} {[""]}
{["POL $A2" ]} {["" ]} {["" ]} {["" ]} {[""]} {[""]} {[""]} {[""]} {[""]} {[""]} {[""]}
{["POL DC03"]} {["POL DC04"]} {["POL $A1"]} {["POL $A2"]} {[""]} {[""]} {[""]} {[""]} {[""]} {[""]} {[""]}
{["POL DC03"]} {["POL DC04"]} {["POL $A1"]} {["POL $A2"]} {[""]} {[""]} {[""]} {[""]} {[""]} {[""]} {[""]}
{["POL DC03"]} {["POL DC04"]} {["POL $A1"]} {["POL $A2"]} {[""]} {[""]} {[""]} {[""]} {[""]} {[""]} {[""]}
{["POL DC03"]} {["POL DC04"]} {["POL $A1"]} {["POL $A2"]} {[""]} {[""]} {[""]} {[""]} {[""]} {[""]} {[""]}
{["" ]} {["" ]} {["" ]} {["" ]} {[""]} {[""]} {[""]} {[""]} {[""]} {[""]} {[""]}
{["" ]} {["" ]} {["" ]} {["" ]} {[""]} {[""]} {[""]} {[""]} {[""]} {[""]} {[""]}
{["" ]} {["" ]} {["" ]} {["" ]} {[""]} {[""]} {[""]} {[""]} {[""]} {[""]} {[""]}
{["" ]} {["" ]} {["" ]} {["" ]} {[""]} {[""]} {[""]} {[""]} {[""]} {[""]} {[""]}
{["" ]} {["" ]} {["" ]} {["" ]} {[""]} {[""]} {[""]} {[""]} {[""]} {[""]} {[""]}
2 Comments
Matt J
on 22 Jun 2023
But why have a cell array at all? Why not just make infon2 into a big string matrix,
load infon2
c=infon2(:,end);
L=max(cellfun(@numel,c));
for i=1:numel(c)
c{i}(end+1:L)="";
end
c=vertcat(c{:});
infon2=[string(infon2(:,1:end-1)) , c];
More Answers (1)
Stephen23
on 22 Jun 2023
Why are you storing numeric data as text? That must make data processing very awkward: most likely better data design would be to use e.g. a table, which lets you keep all of the data types of each column i.e. store and process numeric data as numeric.
S = load('infon2.mat');
C = S.infon2
C = 240×5 cell array
{'1' } {'200' } {'150.995'} {'common'} {["Fp1-Ref" "Fp2-Ref" … ]}
{'2' } {'200' } {'96.995' } {'common'} {["Fp1-Ref" "Fp2-Ref" … ]}
{'3' } {'200' } {'219.995'} {'common'} {["Fp1-Ref" "Fp2-Ref" … ]}
{'4' } {'200' } {'68.995' } {'common'} {["Fp1-Ref" "Fp2-Ref" … ]}
{'5' } {'200' } {'289.995'} {'common'} {["Fp1-Ref" "Fp2-Ref" … ]}
{'6' } {'200' } {'824.995'} {'common'} {["Fp1-Ref" "Fp2-Ref" … ]}
{'7' } {'200' } {'218.995'} {'common'} {["Fp1-Ref" "Fp2-Ref" … ]}
{'8' } {'200' } {'217.995'} {'common'} {["Fp1-Ref" "Fp2-Ref" … ]}
{'9' } {'200' } {'58.995' } {'common'} {["Fp1-Ref" "Fp2-Ref" … ]}
{'10'} {'200' } {'57.995' } {'common'} {["Fp1-Ref" "Fp2-Ref" … ]}
{'11'} {'200' } {'43.995' } {'common'} {["Fp1-Ref" "Fp2-Ref" … ]}
{'12'} {'1000'} {'41.579' } {'common'} {["Fp1-Ref" "Fp2-Ref" … ]}
{'13'} {'200' } {'248.995'} {'common'} {["Fp1-Ref" "Fp2-Ref" … ]}
{'14'} {'200' } {'319.995'} {'common'} {["Fp1-Ref" "Fp2-Ref" … ]}
{'15'} {'200' } {'109.995'} {'common'} {["Fp1-Ref" "Fp2-Ref" … ]}
{'16'} {'200' } {'89.995' } {'common'} {["Fp1-Ref" "Fp2-Ref" … ]}
N = size(C,1);
D = cell(N,0);
for k = 1:N
V = cellstr(C{k,5});
D(k,1:numel(V)) = V;
end
D = [C(:,1:4),D]
D = 240×47 cell array
Columns 1 through 14
{'1' } {'200' } {'150.995'} {'common'} {'Fp1-Ref'} {'Fp2-Ref'} {'F3-Ref'} {'F4-Ref'} {'C3-Ref'} {'C4-Ref'} {'P3-Ref'} {'P4-Ref'} {'O1-Ref'} {'O2-Ref'}
{'2' } {'200' } {'96.995' } {'common'} {'Fp1-Ref'} {'Fp2-Ref'} {'F3-Ref'} {'F4-Ref'} {'C3-Ref'} {'C4-Ref'} {'P3-Ref'} {'P4-Ref'} {'O1-Ref'} {'O2-Ref'}
{'3' } {'200' } {'219.995'} {'common'} {'Fp1-Ref'} {'Fp2-Ref'} {'F3-Ref'} {'F4-Ref'} {'C3-Ref'} {'C4-Ref'} {'P3-Ref'} {'P4-Ref'} {'O1-Ref'} {'O2-Ref'}
{'4' } {'200' } {'68.995' } {'common'} {'Fp1-Ref'} {'Fp2-Ref'} {'F3-Ref'} {'F4-Ref'} {'C3-Ref'} {'C4-Ref'} {'P3-Ref'} {'P4-Ref'} {'O1-Ref'} {'O2-Ref'}
{'5' } {'200' } {'289.995'} {'common'} {'Fp1-Ref'} {'Fp2-Ref'} {'F3-Ref'} {'F4-Ref'} {'C3-Ref'} {'C4-Ref'} {'P3-Ref'} {'P4-Ref'} {'O1-Ref'} {'O2-Ref'}
{'6' } {'200' } {'824.995'} {'common'} {'Fp1-Ref'} {'Fp2-Ref'} {'F3-Ref'} {'F4-Ref'} {'C3-Ref'} {'C4-Ref'} {'P3-Ref'} {'P4-Ref'} {'O1-Ref'} {'O2-Ref'}
{'7' } {'200' } {'218.995'} {'common'} {'Fp1-Ref'} {'Fp2-Ref'} {'F3-Ref'} {'F4-Ref'} {'C3-Ref'} {'C4-Ref'} {'P3-Ref'} {'P4-Ref'} {'O1-Ref'} {'O2-Ref'}
{'8' } {'200' } {'217.995'} {'common'} {'Fp1-Ref'} {'Fp2-Ref'} {'F3-Ref'} {'F4-Ref'} {'C3-Ref'} {'C4-Ref'} {'P3-Ref'} {'P4-Ref'} {'O1-Ref'} {'O2-Ref'}
{'9' } {'200' } {'58.995' } {'common'} {'Fp1-Ref'} {'Fp2-Ref'} {'F3-Ref'} {'F4-Ref'} {'C3-Ref'} {'C4-Ref'} {'P3-Ref'} {'P4-Ref'} {'O1-Ref'} {'O2-Ref'}
{'10'} {'200' } {'57.995' } {'common'} {'Fp1-Ref'} {'Fp2-Ref'} {'F3-Ref'} {'F4-Ref'} {'C3-Ref'} {'C4-Ref'} {'P3-Ref'} {'P4-Ref'} {'O1-Ref'} {'O2-Ref'}
{'11'} {'200' } {'43.995' } {'common'} {'Fp1-Ref'} {'Fp2-Ref'} {'F3-Ref'} {'F4-Ref'} {'C3-Ref'} {'C4-Ref'} {'P3-Ref'} {'P4-Ref'} {'O1-Ref'} {'O2-Ref'}
{'12'} {'1000'} {'41.579' } {'common'} {'Fp1-Ref'} {'Fp2-Ref'} {'F3-Ref'} {'F4-Ref'} {'C3-Ref'} {'C4-Ref'} {'P3-Ref'} {'P4-Ref'} {'O1-Ref'} {'O2-Ref'}
{'13'} {'200' } {'248.995'} {'common'} {'Fp1-Ref'} {'Fp2-Ref'} {'F3-Ref'} {'F4-Ref'} {'C3-Ref'} {'C4-Ref'} {'P3-Ref'} {'P4-Ref'} {'O1-Ref'} {'O2-Ref'}
{'14'} {'200' } {'319.995'} {'common'} {'Fp1-Ref'} {'Fp2-Ref'} {'F3-Ref'} {'F4-Ref'} {'C3-Ref'} {'C4-Ref'} {'P3-Ref'} {'P4-Ref'} {'O1-Ref'} {'O2-Ref'}
{'15'} {'200' } {'109.995'} {'common'} {'Fp1-Ref'} {'Fp2-Ref'} {'F3-Ref'} {'F4-Ref'} {'C3-Ref'} {'C4-Ref'} {'P3-Ref'} {'P4-Ref'} {'O1-Ref'} {'O2-Ref'}
{'16'} {'200' } {'89.995' } {'common'} {'Fp1-Ref'} {'Fp2-Ref'} {'F3-Ref'} {'F4-Ref'} {'C3-Ref'} {'C4-Ref'} {'P3-Ref'} {'P4-Ref'} {'O1-Ref'} {'O2-Ref'}
Columns 15 through 28
{'F7-Ref'} {'F8-Ref'} {'T3-Ref'} {'T4-Ref'} {'T5-Ref'} {'T6-Ref'} {'Fz-Ref'} {'Cz-Ref'} {'Pz-Ref'} {'POL E'} {'POL PG1'} {'POL PG2'} {'A1-Ref'} {'A2-Ref'}
{'F7-Ref'} {'F8-Ref'} {'T3-Ref'} {'T4-Ref'} {'T5-Ref'} {'T6-Ref'} {'Fz-Ref'} {'Cz-Ref'} {'Pz-Ref'} {'POL E'} {'POL PG1'} {'POL PG2'} {'A1-Ref'} {'A2-Ref'}
{'F7-Ref'} {'F8-Ref'} {'T3-Ref'} {'T4-Ref'} {'T5-Ref'} {'T6-Ref'} {'Fz-Ref'} {'Cz-Ref'} {'Pz-Ref'} {'POL E'} {'POL PG1'} {'POL PG2'} {'A1-Ref'} {'A2-Ref'}
{'F7-Ref'} {'F8-Ref'} {'T3-Ref'} {'T4-Ref'} {'T5-Ref'} {'T6-Ref'} {'Fz-Ref'} {'Cz-Ref'} {'Pz-Ref'} {'POL E'} {'POL PG1'} {'POL PG2'} {'A1-Ref'} {'A2-Ref'}
{'F7-Ref'} {'F8-Ref'} {'T3-Ref'} {'T4-Ref'} {'T5-Ref'} {'T6-Ref'} {'Fz-Ref'} {'Cz-Ref'} {'Pz-Ref'} {'POL E'} {'POL PG1'} {'POL PG2'} {'A1-Ref'} {'A2-Ref'}
{'F7-Ref'} {'F8-Ref'} {'T3-Ref'} {'T4-Ref'} {'T5-Ref'} {'T6-Ref'} {'Fz-Ref'} {'Cz-Ref'} {'Pz-Ref'} {'POL E'} {'POL PG1'} {'POL PG2'} {'A1-Ref'} {'A2-Ref'}
{'F7-Ref'} {'F8-Ref'} {'T3-Ref'} {'T4-Ref'} {'T5-Ref'} {'T6-Ref'} {'Fz-Ref'} {'Cz-Ref'} {'Pz-Ref'} {'POL E'} {'POL PG1'} {'POL PG2'} {'A1-Ref'} {'A2-Ref'}
{'F7-Ref'} {'F8-Ref'} {'T3-Ref'} {'T4-Ref'} {'T5-Ref'} {'T6-Ref'} {'Fz-Ref'} {'Cz-Ref'} {'Pz-Ref'} {'POL E'} {'POL PG1'} {'POL PG2'} {'A1-Ref'} {'A2-Ref'}
{'F7-Ref'} {'F8-Ref'} {'T3-Ref'} {'T4-Ref'} {'T5-Ref'} {'T6-Ref'} {'Fz-Ref'} {'Cz-Ref'} {'Pz-Ref'} {'POL E'} {'POL PG1'} {'POL PG2'} {'A1-Ref'} {'A2-Ref'}
{'F7-Ref'} {'F8-Ref'} {'T3-Ref'} {'T4-Ref'} {'T5-Ref'} {'T6-Ref'} {'Fz-Ref'} {'Cz-Ref'} {'Pz-Ref'} {'POL E'} {'POL PG1'} {'POL PG2'} {'A1-Ref'} {'A2-Ref'}
{'F7-Ref'} {'F8-Ref'} {'T3-Ref'} {'T4-Ref'} {'T5-Ref'} {'T6-Ref'} {'Fz-Ref'} {'Cz-Ref'} {'Pz-Ref'} {'POL E'} {'POL PG1'} {'POL PG2'} {'A1-Ref'} {'A2-Ref'}
{'F7-Ref'} {'F8-Ref'} {'T3-Ref'} {'T4-Ref'} {'T5-Ref'} {'T6-Ref'} {'Fz-Ref'} {'Cz-Ref'} {'Pz-Ref'} {'POL E'} {'POL PG1'} {'POL PG2'} {'A1-Ref'} {'A2-Ref'}
{'F7-Ref'} {'F8-Ref'} {'T3-Ref'} {'T4-Ref'} {'T5-Ref'} {'T6-Ref'} {'Fz-Ref'} {'Cz-Ref'} {'Pz-Ref'} {'POL E'} {'POL PG1'} {'POL PG2'} {'A1-Ref'} {'A2-Ref'}
{'F7-Ref'} {'F8-Ref'} {'T3-Ref'} {'T4-Ref'} {'T5-Ref'} {'T6-Ref'} {'Fz-Ref'} {'Cz-Ref'} {'Pz-Ref'} {'POL E'} {'POL PG1'} {'POL PG2'} {'A1-Ref'} {'A2-Ref'}
{'F7-Ref'} {'F8-Ref'} {'T3-Ref'} {'T4-Ref'} {'T5-Ref'} {'T6-Ref'} {'Fz-Ref'} {'Cz-Ref'} {'Pz-Ref'} {'POL E'} {'POL PG1'} {'POL PG2'} {'A1-Ref'} {'A2-Ref'}
{'F7-Ref'} {'F8-Ref'} {'T3-Ref'} {'T4-Ref'} {'T5-Ref'} {'T6-Ref'} {'Fz-Ref'} {'Cz-Ref'} {'Pz-Ref'} {'POL E'} {'POL PG1'} {'POL PG2'} {'A1-Ref'} {'A2-Ref'}
Columns 29 through 40
{'POL T1'} {'POL T2'} {'POL X1'} {'POL X2'} {'POL DC01'} {'POL DC02'} {'POL DC03'} {'POL $A1' } {'POL $A2' } {0×0 double} {0×0 double} {0×0 double}
{'POL T1'} {'POL T2'} {'POL X1'} {'POL X2'} {'POL DC01'} {'POL DC02'} {'POL DC03'} {'POL $A1' } {'POL $A2' } {0×0 double} {0×0 double} {0×0 double}
{'POL T1'} {'POL T2'} {'POL X1'} {'POL X2'} {'POL X3' } {'POL X4' } {'POL DC01'} {'POL DC02'} {'POL DC03'} {'POL DC04'} {'POL $A1' } {'POL $A2' }
{'POL T1'} {'POL T2'} {'POL X1'} {'POL X2'} {'POL X3' } {'POL X4' } {'POL DC01'} {'POL DC02'} {'POL DC03'} {'POL DC04'} {'POL $A1' } {'POL $A2' }
{'POL T1'} {'POL T2'} {'POL X1'} {'POL X2'} {'POL DC01'} {'POL DC02'} {'POL DC03'} {'POL $A1' } {'POL $A2' } {0×0 double} {0×0 double} {0×0 double}
{'POL T1'} {'POL T2'} {'POL X1'} {'POL X2'} {'POL DC01'} {'POL DC02'} {'POL DC03'} {'POL $A1' } {'POL $A2' } {0×0 double} {0×0 double} {0×0 double}
{'POL T1'} {'POL T2'} {'POL X1'} {'POL X2'} {'POL DC01'} {'POL DC02'} {'POL DC03'} {'POL $A1' } {'POL $A2' } {0×0 double} {0×0 double} {0×0 double}
{'POL T1'} {'POL T2'} {'POL X1'} {'POL X2'} {'POL X3' } {'POL X4' } {'POL DC01'} {'POL DC02'} {'POL DC03'} {'POL DC04'} {'POL $A1' } {'POL $A2' }
{'POL T1'} {'POL T2'} {'POL X1'} {'POL X2'} {'POL X3' } {'POL X4' } {'POL DC01'} {'POL DC02'} {'POL DC03'} {'POL DC04'} {'POL $A1' } {'POL $A2' }
{'POL T1'} {'POL T2'} {'POL X1'} {'POL X2'} {'POL X3' } {'POL X4' } {'POL DC01'} {'POL DC02'} {'POL DC03'} {'POL DC04'} {'POL $A1' } {'POL $A2' }
{'POL T1'} {'POL T2'} {'POL X1'} {'POL X2'} {'POL X3' } {'POL X4' } {'POL DC01'} {'POL DC02'} {'POL DC03'} {'POL DC04'} {'POL $A1' } {'POL $A2' }
{'POL T1'} {'POL T2'} {'POL X1'} {'POL X2'} {'POL $A1' } {'POL $A2' } {0×0 double} {0×0 double} {0×0 double} {0×0 double} {0×0 double} {0×0 double}
{'POL T1'} {'POL T2'} {'POL X1'} {'POL X2'} {'POL $A1' } {'POL $A2' } {0×0 double} {0×0 double} {0×0 double} {0×0 double} {0×0 double} {0×0 double}
{'POL T1'} {'POL T2'} {'POL X1'} {'POL X2'} {'POL $A1' } {'POL $A2' } {0×0 double} {0×0 double} {0×0 double} {0×0 double} {0×0 double} {0×0 double}
{'POL T1'} {'POL T2'} {'POL X1'} {'POL X2'} {'POL $A1' } {'POL $A2' } {0×0 double} {0×0 double} {0×0 double} {0×0 double} {0×0 double} {0×0 double}
{'POL T1'} {'POL T2'} {'POL X1'} {'POL X2'} {'POL $A1' } {'POL $A2' } {0×0 double} {0×0 double} {0×0 double} {0×0 double} {0×0 double} {0×0 double}
Columns 41 through 47
{0×0 double} {0×0 double} {0×0 double} {0×0 double} {0×0 double} {0×0 double} {0×0 double}
{0×0 double} {0×0 double} {0×0 double} {0×0 double} {0×0 double} {0×0 double} {0×0 double}
{0×0 double} {0×0 double} {0×0 double} {0×0 double} {0×0 double} {0×0 double} {0×0 double}
{0×0 double} {0×0 double} {0×0 double} {0×0 double} {0×0 double} {0×0 double} {0×0 double}
{0×0 double} {0×0 double} {0×0 double} {0×0 double} {0×0 double} {0×0 double} {0×0 double}
{0×0 double} {0×0 double} {0×0 double} {0×0 double} {0×0 double} {0×0 double} {0×0 double}
{0×0 double} {0×0 double} {0×0 double} {0×0 double} {0×0 double} {0×0 double} {0×0 double}
{0×0 double} {0×0 double} {0×0 double} {0×0 double} {0×0 double} {0×0 double} {0×0 double}
{0×0 double} {0×0 double} {0×0 double} {0×0 double} {0×0 double} {0×0 double} {0×0 double}
{0×0 double} {0×0 double} {0×0 double} {0×0 double} {0×0 double} {0×0 double} {0×0 double}
{0×0 double} {0×0 double} {0×0 double} {0×0 double} {0×0 double} {0×0 double} {0×0 double}
{0×0 double} {0×0 double} {0×0 double} {0×0 double} {0×0 double} {0×0 double} {0×0 double}
{0×0 double} {0×0 double} {0×0 double} {0×0 double} {0×0 double} {0×0 double} {0×0 double}
{0×0 double} {0×0 double} {0×0 double} {0×0 double} {0×0 double} {0×0 double} {0×0 double}
{0×0 double} {0×0 double} {0×0 double} {0×0 double} {0×0 double} {0×0 double} {0×0 double}
{0×0 double} {0×0 double} {0×0 double} {0×0 double} {0×0 double} {0×0 double} {0×0 double}
"eventually write out the complete lsit to an excel"
writecell(D,'mytable.xlsx')
8 Comments
Joanne Hall
on 22 Jun 2023
... might there be an easy way to remove the '-ref' ending from all channel locations labels in this list?
Thanks again for the above code Its prefect!
JOanne
Joanne Hall
on 22 Jun 2023
It does get rid of 'ref! but for some channels, without the '-ref' ending, like '"POL E" ,"POL PG1", "POL PG2"', it replaces those cells with 'missing'
Stephen23
on 22 Jun 2023
Edited: Stephen23
on 22 Jun 2023
I would use either STRREP or REGEXPREP, which will not replace your data with "missing":
A = ["FP1-Ref", "FP2-Ref", "POL E", "POL PG1", "POL PG2"];
B = strrep(A,'-Ref','')
B = 1×5 string array
"FP1" "FP2" "POL E" "POL PG1" "POL PG2"
B = regexprep(A,'-Ref$','')
B = 1×5 string array
"FP1" "FP2" "POL E" "POL PG1" "POL PG2"
Note that "extracting before something" has no meaning when that something does not exist. In contrast, using the correct functions works as expected.
Joanne Hall
on 22 Jun 2023
Edited: Joanne Hall
on 22 Jun 2023
I just want to say thanks again to both Stephne and Matt, because I'm using things both have taugh me today in my other codes. so much appreciated. And its the little kindnesses that you do in your day that really make a difference in people's lives and jobs.
See Also
Categories
Find more on Data Type Identification in Help Center and File Exchange
Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!An Error Occurred
Unable to complete the action because of changes made to the page. Reload the page to see its updated state.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom(English)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)