Importing Excel file data and creating variables with the imported data
1 回表示 (過去 30 日間)
古いコメントを表示
My project group were given an excel spreadsheet with columns of 10 flight conditions with rows being the variables within the flight conditions (airspeed, weight, Cl_alpha, etc.). There are 52 rows and 10 colummns and it will be tedious to hand type in the data.
We are looking for a efficient way to import the data, organize it into individual flight conditions (FC1, FC2, FC3,..., FCn) or have all of the variables be made into arrays for each flight condition so that we can call the flight condition we want to analyze. Is there a way to do that?
I have attached the excel file. We are using the Diamond DA40 sheet for data as reference.
0 件のコメント
回答 (1 件)
Mathieu NOE
2022 年 12 月 5 日
hello
work with tables or structures...(read doc / help sections if your are not familiar with them )
here a starter
% Importing Data from excel across multiple sheets.
filename = 'Aircraft S&C Derivatives (1).xlsx';
[~,sheet_name]=xlsfinfo(filename);
nsheets = numel(sheet_name);
% retrieve raw data
for k = 1:nsheets % nsheets
T{k} = readtable(filename,"Sheet",sheet_name{k}); % table
S{k} = table2struct(T{k},'ToScalar',true); % convert table 2 structure : NB : converts the table T to a scalar structure S.
% Each variable of T becomes a field in S.
S{k}.Name = sheet_name{k}; % here I use the sheet name to name the structure
% your own code below...
end
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Data Import from MATLAB についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!