How to read data from a Excel file and insert data within each sheet in a already created cell array
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Behrooz Daneshian
am 4 Feb. 2023
Kommentiert: Sulaymon Eshkabilov
am 4 Feb. 2023
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 Kommentare
Akzeptierte Antwort
Sulaymon Eshkabilov
am 4 Feb. 2023
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 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Spreadsheets finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!