saving vectors to an excel file

3 visualizaciones (últimos 30 días)
John
John el 25 de Mzo. de 2012
Hello,
I am importing data from excel files, performing a process and saving data to a .mat file.
My question is, how could I save the vectors x and y2 to an excel file in a different folder but with the same name as the original excel file?
I've attempted it below but I'm not sure of the correct syntax?
Thank you
files = cellstr(ls('*.xls'));
for k = 1:length(files)
sch_cycle = xlsread(files{k}, 'Input_data');
nrows = size(sch_cycle,1)-1;
x = sch_cycle(:,1);
y = sch_cycle(:,2);
h=2;
N= size(sch_cycle,1);
r=ksr(x,y,h,N)
y1=r.f';
y = y(:);
y1 = y1(:);
y2 = [y(1:3); y1(4:end-3); y(end-2:end)];
sch_cycle = [x y2];
sch_grade=[0,0;nrows,0];
sch_grade=[0 0;nrows 0];
sch_key_on=[0 1; nrows 1];
[~,fn] = fileparts(files{k});
sch_metadata.name = fn;
sch_metadata.proprietary='public';
save([fn,'.mat'],'sch_cycle','sch_grade','sch_key_on','sch_metadata');
xlswrite(C:\Folder\files{k}, x y2)
end

Respuestas (1)

Geoff
Geoff el 25 de Mzo. de 2012
To build the filename use:
['C:\Folder\' files{k}]

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by