The data you have is a "cell array" of "timetable" data. You can search for a variable by its name using a MATLAB Script to iterate through the "call array". To save the data to excel file, "writetable" function can be used.
Here is a simple code which searches for a variable name and saves the "timetable" data in different sheets of excel file.
searchColumnName = 'Var2';
matchingTimetables = {};
for i = 1:length(timetables)
currentTimetable = timetables{i};
if any(strcmp(currentTimetable.Properties.VariableNames, searchColumnName))
matchingTimetables{end+1} = currentTimetable;
end
end
if ~isempty(matchingTimetables)
filename = 'MatchingTimetables.xlsx';
for j = 1:length(matchingTimetables)
sheetName = ['Timetable' num2str(j)];
writetable(timetable2table(matchingTimetables{j}), filename, 'Sheet', sheetName);
end
disp(['Matching timetables exported to ', filename]);
else
disp('No timetables found with the specified column name.');
end
You can learn more about "timetable" and "writetable" by using the following commands in MATLAB to access the documentation.
web(fullfile(docroot, 'matlab/ref/timetable.html'))
web(fullfile(docroot, 'matlab/ref/writetable.html'))


