フィルターのクリア

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 Center および File ExchangePrinting and Saving についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by