Your loop will want to start with grabbing all files in a folder. uigetfile with the MultiSelect option will work wonders here:
[Name,Path]=uigetfile({'*.xlsx*'},'MultiSelect','on');
entirefile=fullfile(Paths,Names);
Then start your loop. It wants to run a number of times equal to the number of elements in your entirefile cell, as you also have in your own code. Within this loop, do all your loading, calculation and writing. To avoid cluttering the workspace, you might want to look into a structure and dot indexing.
for i=1:numel(entirefile);
enginedata(i).raw=importdata(entirefile{i});
enginedata(i).temperature = your temperature calculation
enginedata(i).oilpressure = oil pressure calculation
celltarget=['B',num2str(i)];
writecell(mean_engine_temperature,filename,'Sheet','Temperatures','Range',celltarget);
end
Best Answer