필터 지우기
필터 지우기

How to use "saveas" without pressing "ok"?

조회 수: 1 (최근 30일)
Lianna Johnson
Lianna Johnson 2013년 6월 19일
I am trying to automate a Matlab script through Task Scheduler. The script works fine, but when I use the saveas function, a window still pops up asking if the filename to save it as is okay or if it should be cancel. I want it to save without this window popping up. Here is my script...
function concatFileName=myKWconcat(FileName,PathName)
PathName='T:\10 - VEHICLE TESTING RESULTS\2011 KENWORTH ISX15\10 - CANAPE FILES\1306\MAT_raw\'; FileName = mydatesearch(PathName);
S = struct('t',[]); for i=1:length(FileName) B = load([PathName char(FileName(i))]); l = length(B.t);
var_names = union(fieldnames(S),fieldnames(B));
var_new = var_names(~ismember(var_names,fieldnames(S)));
for j=1:length(var_new)
S.(var_new{j}) = zeros(length(S.t),1);
end
for j=1:length(var_names)
if isfield(B,var_names(j)) & length(B.(var_names{j}))==l
S.(var_names{j}) = [S.(var_names{j}); B.(var_names{j})];
else
S.(var_names{j}) = [S.(var_names{j}); zeros(l,1)];
end
end
disp(['File(' num2str(i) '/' num2str(length(FileName)) ') Done: ' char(FileName(i))]);
end
Base = strtok(FileName{1}, '_'); concatFileName = inputdlg('File Name:','Save As...',1,{[Base '_SPLBRENT3_concat.mat']}); saveas([PathName char(concatFileName)],'-struct','S','*');
clear B Base S i j l var_names var_new load([PathName char(concatFileName)]); clear concatFileName PathName

채택된 답변

Iain
Iain 2013년 6월 19일
Your problem is:
concatFileName = inputdlg('File Name:','Save As...',1,{[Base '_SPLBRENT3_concat.mat']});
You should do "something" to make this line not apply, either by using an appropriate if statement, or by commenting it out. - But you'll still need to get a filename from somewhere.
  댓글 수: 1
Lianna Johnson
Lianna Johnson 2013년 6월 19일
Thank you very much! I actually didn't write that script so I didn't even know what that line was for. Thanks!!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Printing and Saving에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by