フィルターのクリア

Form a matrix with specific day types

1 回表示 (過去 30 日間)
pavlos
pavlos 2014 年 2 月 9 日
回答済み: Azzi Abdelmalek 2014 年 2 月 9 日
Hello,
Please help me with the following.
I have a matrix with dates as entries in the form:
01/01/2013 2 a
01/02/2013 3 b
01/03/2013 4 c
etc.
The right side digits denote the type of day, "1" is for Monday, "2" for Tuesday, "3" for Wednesday etc. and "a", "b" and "c" are values that are recorded in the specific dates.
How can I extract all the Mondays of the year with the respective values in a seperate matrix?
The new matrix should have the form:
01/07/2013 1 aa
01/14/2013 1 ab
01/21/2013 1 ac
etc.
Thank you very much. Best,
Pavlos

採用された回答

Azzi Abdelmalek
Azzi Abdelmalek 2014 年 2 月 9 日
M={'01/01/2013' 2 'a'
'01/02/2013' 3 'b'
'01/03/2013' 4 'c'
'01/01/2013' 2 'a'
'01/02/2013' 2 'b'
'01/03/2013' 4 'c'}
day=2;
idx=ismember(cell2mat(M(:,2)),day)
out=M(idx,:)

その他の回答 (0 件)

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by