马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?我要加入
x
% --- Executes on button press in pushbutton9.
function pushbutton9_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton9 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global gfile;
[filename3, pathname3, filterindex3] =uigetfile({'*.ts2;*.ts3;*.ts4;*.ts5';'*.ts2';'*.ts3';'*.ts4';'*.ts5'}, 'MultiSelect','on');
pathfile3=strcat(pathname3,filename3);
handles.pathfile3=pathfile3;
handles.filterindex3=filterindex3;
guidata(hObject, handles);
if iscell(handles.pathfile3)
[m,n]=size(handles.pathfile3);
for na=1:n
gfile=[gfile;cellstr(handles.pathfile3(1,na))];
end
else
gfile=[gfile;cellstr(handles.pathfile3)];
end
assignin('base','gf',gfile);
prompt={'想加字符:'};
def={'a'};
dlgTitle='输入 字符';
lineNo=1;
zf=inputdlg(prompt,dlgTitle,lineNo,def);
assignin('base','zfs',zf);
[m1,n1]=size(gfile);
for m2=1:m1
[mm,nn]=size(gfile{m2});
newname = [gfile{m2}(1:nn-4),zf{1},gfile{m2}(nn-3:nn)];
status = system(['rename' ' ' gfile{m2} ' ' newname]);
end
设计了一个按钮,现在选中的文件名后加一个a,比如:文件名为w.txt,变为wa.txt
前面都没错,就最后for循环里的改文件名的system有错,但不知道怎么改,请高手帮帮忙吧!!! |