1.使用循环命名变量并赋值 eval target: x1=1; x2=2; x3=3; alternative: for i=1:3 eval(['x',num2str(i),'=',num2str(i),';']); end 感觉eval是把括号里的字符串当做命令来执行。感觉还是蛮方便的