Matlab experts say ' eval is evil'. I use eval in the case when I read Edit Text data in GUI and str2double is not applicable. For example, I need to type, read and save (in cell-array) an arbitrary array with arbitrary length, say A=[1,5,9]. I do:
set(handles.A_edit,'String','[1,5,9]')C{1}=get(handles.A_edit,'String');A=eval(C{1});
Is there any other way to do the job without using eval?
Best Answer