How to read data from a Excel file and insert data within each sheet in a already created cell array
1 次查看(过去 30 天)
显示 更早的评论
Hi all,
Temperature data for 333 weather stations in Alaska state are stored in an Excel file(each sheet in this file represents data for one weather station). I want to insert data within each sheet of this Excel file in column 8 of an already-created cell array. Please note that I want data within each sheet to be inserted in the cell array as a table. There are already tables in column 8 of the array but these data have missing values, and I want them to be replaced by the data in the Excel file.
It should also be noted that I was not allowed to upload files larger than 5 MB. Hence, I just created representative files( actually, the main Excel file has 333 pages and the main mat file has 333 rows, but here I have just brought 5 stations to show you the concept of my problem).
0 个评论
采纳的回答
Sulaymon Eshkabilov
2023-2-4
This is how it can be attained:
load('Test.mat') %
FName ='Test.xlsx';
S_names = sheetnames(FName);
for ii=1:numel(S_names)
D{ii}=readtable(FName, 'Sheet', S_names(ii)); % Data read as a table array
stations11{ii,8} = D{ii}; % Inserted in column 8 of the existing variable: stations11
end
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Spreadsheets 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!