目录都用反斜杠,这样windows和Linux目录都认,Linux只认反斜杠 
当前目录:
for s=1:20
    filename = num2str(s);
    load (filename);
end
当前目录 的下一层目录
for s=1:20
    %filename = ['./50Train/',num2str(s),'.mat'];  % 这种方式应该更快,省得字符串操作
    %filename = ['50Train/',num2str(s)];    % 最前面的./不加也可以
    %filename = ['./50Train/',num2str(s)];
    filename = strcat('./50Train/',num2str(s));
    load (filename);
end
当前目录的上一层目录:
for s=1:20
    %filename = ['../50Train/',num2str(s),'.mat']; 
    %filename = ['../50Train/',num2str(s)];
    filename = strcat('../50Train/',num2str(s));
    load (filename);
end

dataName = '../Parmprint.mat';% '.. / Parmprint / '和 Parmprint.mat/'都不行
例:caffe-master-20151202\caffe-master\matlab\demo\classification_demo.m,  im = imread('../../examples/images/cat.jpg');
----------------------------------------------------------------------
  想编一个循环,每个文件名依次是1,2,等到num
for i =1:num
    savefile = [num2str(i),'.mat'];
    save(savefile, 'trainIdx', 'testIdx');%trainIdx 和testIdx 可以是其他任何变量
end

save的名字中含有小数点
ratio = 0.01;
savefile = ['NFL_ASLAN',num2str(ratio),'.mat'];
save(savefile, 'accuracy');
见我的matlab教材P20