【发布时间】:2017-11-11 14:00:46
【问题描述】:
我是 matlab 的新手,在这件事上陷入困境。我尝试使用 matlab 代码从多个 excel 文件中创建一个新文件。它设法生成了新文件。但是文件一团糟,我真的不知道该怎么做。代码如下:
% Merge multiple XLS files into one XLS file
[filenames, folder] = uigetfile('*.xls','Select the data file','MultiSelect','on'); % gets directory from any folder
% Create output file name in the same folder.
outputFileName = fullfile(folder, 'rainfall.xls');
fidOutput = fopen(outputFileName, 'wt'); % open output file to write
for k = 1 : length(filenames)
% Get this file name.
thisFileName = fullfile(folder, filenames{k});
% Open input file:
fidInput = fopen(thisFileName);
% Read text from it
thisText = fread(fidInput, '*char');
% Copy to output file:
fwrite(fidOutput, thisText);
fclose(fidInput); % close the input file
end
fclose(fidOutput);
【问题讨论】:
-
同样的问题一遍又一遍,没有努力让事情正常进行。只需查看 OP 的配置文件活动即可。
标签: excel matlab matlab-guide