Date: Jan 22, 2013 6:04 PM
Author: Sadik
Subject: Re: Convert a list of strings 'x[1]', 'x[2]',... into workspace variable arrays.

Hi Andrew,

I copied and pasted your list starting from 'on_state' directly from your post with no modification into a file named list.txt, did the following and it worked:

fid = fopen('list.txt')
c = textscan(fid,'%s %s')
names = c{1};
values = c{2};
names = strrep(names,'''','');
names = strrep(names,'[','(');
names = strrep(names,']',')')
linesToEval = strcat(names,repmat('=',length(names),1),values);
cellfun(@eval,ans);

Best.