How to read data from a Excel file and insert data within each sheet in a already created cell array
1 回表示 (過去 30 日間)
古いコメントを表示
Behrooz Daneshian
2023 年 2 月 4 日
コメント済み: Sulaymon Eshkabilov
2023 年 2 月 4 日
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
2 件のコメント
その他の回答 (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!