Info

This question is closed. Reopen it to edit or answer.

Help with if condition

1 view (last 30 days)
Carlos Alvarez-Santullano
Closed: Stephen23 on 6 May 2017
he thing is i have a matrix where the first column is the code of the item sold and the second column is the week where that item were sold. Im trying to know the frecuency of sales of each item im working with (meaning this if the item has been sold every week or just in a few weeks).
This is my matrix
Item week
0012 1
0013 1
0012 2
0012 2
0012 2
0013 2
0013 3
n 53
So i want to know how to make a code that give me as a result this
Item week1 week2 week3 week4 week5
0012 1 1 0 0 1
0013 0 0 1 0 0
n 1 0 1 1 0
Meaning this the item 0012 were sold on week1 week2 week5 no sales for week3 and week4.
And it would be so much better if possible if the code result is this:
Item week1 week2 week3 week4 week5
0012 1 2 0 0 3
0013 0 0 1 2 0
n 1 0 3 2 0
Meaning this the item 0012 were sold once on week1 twice on week2 and 3 times on week 5.

Answers (0)

This question is closed.

Community Treasure Hunt

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

Start Hunting!