s = struct('strings',{{'hello','yes'}},'lengths',[5 3]) for n = 1:N eval(['EEG_',num2str(n),'=','s']); end