フィルターのクリア

closing specific excel file

3 ビュー (過去 30 日間)
Roozbeh Yousefnejad
Roozbeh Yousefnejad 2018 年 5 月 30 日
Hi all, I am opening some CSV files and then choose some columns and take an average of the last data. At the same time, I separate the name of the CSV files.
Now first, I write the name of the files in the first row. Then I want to write the numbers in matrix M in the second row. But I got an error that the file is open
clc
clear
files = subdir('C:\Users\roozm\Desktop\New folder\*.csv');
for i=1:numel(files)
filename = files(i).name;
sheet = 1;
[filepath,name,ext] = fileparts(filename);
N{i,1}= name;
subset = xlsread(filename,sheet,'A:C');
subset2 = xlsread(filename,sheet,'F:G');
subset3 = xlsread(filename,sheet,'K:N');
subset_merged=[subset,subset2,subset3];
subset_tot=subset_merged([end-6:end-2],:);
M=mean(subset_tot);
end
N=N';
xlswrite('resultset',N);
Can you please advise how can I close the excel file that I have the name in it, and then write the numbers in matrix M in it?
  4 件のコメント
dpb
dpb 2018 年 5 月 30 日
Use the optional Range inputs to xlswrite
Roozbeh Yousefnejad
Roozbeh Yousefnejad 2018 年 5 月 30 日
great, thanks

サインインしてコメントする。

回答 (0 件)

カテゴリ

Help Center および File ExchangeSpreadsheets についてさらに検索

タグ

製品


リリース

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by