eval()函数的功能就是将括号内的字符串视为语句并运行
当需要保存文件到指定文件路径时,必须使用eval函数使matlab读取下例中ID所定义的的内容。
<pre name="code" class="html"> id=cell2mat(VAR(i));
ID=num2str(id);
eval(['savefile = ''F:\cmaq计算结果\关法emis\average\' ID '_ship.mat''']);
save(savefile, 'conc' );