filepath = uigetdir('*.*','请选择文件夹');%fliepath为文件夹路径
fileFolder=fullfile(filepath);
dirOutput=dir(fullfile(fileFolder,'*'));
fileName={dirOutput.name};
fileName=fileName(3:end); %清除前两个系统默认的隐藏文件夹
%去除后缀名
fileName = strrep(fileName,'.bmp','');
fileName = strrep(fileName,'.jpg','');
fileName = strrep(fileName,'.tif','');
fileName = strrep(fileName,'.JPEG','');
fileName = strrep(fileName,'.docx','');
fileName = strrep(fileName,'.doc','');
fileName = strrep(fileName,'.pdf','');
fileName = strrep(fileName,'.txt','');
>> fname='Test.txt'
fnewname=[fname(1:end-4) '.tmp']
fname =
Test.txt
fnewname =
Test.tmp
不行的话就用其他程序或者手动加文件扩展名。这个问题真是难倒我……
还真是没遇到过这种问题。
你直接用load('filename')这样不行么?
提示找不到文件还是怎么样?
楼上的uiimport这东西…… 倒是可以用,不过就需要互动操作
uiimport函数,试试!