There are four coulmns (Subject, Number, ID, ANS) in a table named 'List'. I initialized a structure with each cell having zero matrices for unique value in subject list based on below code. Once this is done I want to scan the column Subject(which has repeated values) and place the ANS value of each row in the Zero matrix of that subject number at 'IDxNumber' (index). This repeates for every subject value found in the Subject column which is 10 next.
List table
Subject Number ID ANS
9 1 10 -1
9 2 10 1
9 3 10 -1
10 1 5 1
10 2 6 -1
c = 1;for b = 1:max(List.Subject) for a = 1:length(List.Subject) if List.Subject(a) == b count_id = sum(List.Subject(:) == b); Subject_Assist{c} = zeros(101,count_id); c = c+1; end endend
Best Answer