Borrar filtros
Borrar filtros

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

1 visualización (últimos 30 días)
Lianna Johnson
Lianna Johnson el 19 de Jun. de 2013
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

Respuesta aceptada

Iain
Iain el 19 de Jun. de 2013
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 comentario
Lianna Johnson
Lianna Johnson el 19 de Jun. de 2013
Thank you very much! I actually didn't write that script so I didn't even know what that line was for. Thanks!!

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Printing and Saving en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by