I want to save variables in a loop with different image names, like
for i = 1:length(imagefile) name = imagefile{i}; var = rand(100); % Just for exam
Sayyad, you don't have to use eval. You can simply use the function form of save, i.e., save(filename,variables). This will use the value of filename. Remember that the variables need to be entered as strings. So, in your example, it would be
eval
save
save(filename,variables)
filename
save(name,'var')