Tuesday, March 24, 2015

batch processing multiple files in matlab using for loop and uigetfile function

Lately I acquired a bunch of information which have the identical format and construction and I want to make use of Matlab to course of every file, which suggests finishing up the identical calculation process to every file. This is the code I created to do that.

% Import the file names
% The *.csv parameter signifies that solely csv information can be proven within the file choice window
% Activate the MultiSelect parameter in order that a number of information may be chosen on the similar time
[filename, ~,~]=uigetfile(*.csv, 'MultiSelect', 'on');
% now use a for loop to hold out similar calculation process to every file
% the process_each_file is a perform that does the calculation process
% earlier than utilizing the for loop, let's outline an area to retailer all of the outputs from every file calculation first
Re=zeros(size(filename),1);
for i = 1 : size(filename)
     Re(i)=process_each_file ( filename(i))
finish




No comments:

Post a Comment