Read excel file correctly

4 ビュー (過去 30 日間)
Joel
Joel 2023 年 4 月 4 日
コメント済み: Stephen23 2023 年 4 月 4 日
I have an excel file that shows 24 values for every day of the year. However, there exists empty rows that needs to be removed.
Although, the Excel-file might look different from year to year, most certainly when there is a leap year.
%Read and edit data
Data=readtable("Data.xlsx");
%Remove empty/unnecessary rows
Data([32:36,65:69,101:105,136:140,172:176,207:211,243:247,279:283,314:318,350:354,385:390,422],:) = [];
% The script continues with
for j=1:365
...
However there will be 366 days during a leap year so j must be defined differently.
  2 件のコメント
Mathieu NOE
Mathieu NOE 2023 年 4 月 4 日
use isnan to locate NaN data in columns and remove correponding rows
Stephen23
Stephen23 2023 年 4 月 4 日

サインインしてコメントする。

採用された回答

Tesfaye Girma
Tesfaye Girma 2023 年 4 月 4 日
correct it manually in the excel itself

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSpreadsheets についてさらに検索

製品


リリース

R2023a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by