How can divide this array into same group ?

I have a matrix contain daily load profile, size 366x97 elements. The column number 97 shows flag of weekday and holiday by 0, 1 respectively.
I want to create matrix A contains only row data with flag 0 (holiday) and matrix B contains only row data with flag 1 (weekday).
How can I separate these raw data into 2 type of day: weekday and holiday ?

 採用された回答

jonas
jonas 2018 年 2 月 27 日
編集済み: jonas 2018 年 2 月 27 日

0 投票

A=DailyloadProfile(find(DailyloadProfile(:,97)==1),:); B=DailyloadProfile(find(DailyloadProfile(:,97)==0),:);

2 件のコメント

Stephen23
Stephen23 2018 年 2 月 27 日
find is totally superfluous, using logical indexing is faster than using find:
B = A(A(:,97)==1,:)
C = A(A(:,97)==0,:)
Pradya Panyainkaew
Pradya Panyainkaew 2018 年 2 月 27 日
Thank you so much sir

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

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeHolidays / Seasons についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by