I have a double matrix B that has in C1 the year 1998 and in C2 a code (unrepeated). Each C2 is given a value in C3.
% C1 C2 C3
B=[ 1998 22 37 1998 34 71998 76 121998 98 291998 107 14 …]
This is how I got to B:
N1=[N{:,1} N{:,2} N{:,3}];N1=unique(N1(:,1:3),'rows'); N3= unique(N1(:,1:2),'rows'); for m=1:size(N3,1) N3(m,3)=sum(N1(:,1) == N3(m,1) & N1(:,2)==N3(m,2));endB=N3((N3(:,1) == 1998),:);
I have a cell-array A with the years horizontally disposed in R1, un-repeated values in Y, and corresponding codes in the columns that follow. The codes are the same as in C2 from variable B, but disposed differently.
A={Y 1996 1997 1998 1999 %R1
1 107 107 22 22 13 98 98 76 1267 … }
Is there a way I could get a new variable that recognizes the change in the codes in variable A, and presents the corresponding values from C3 in B? For instance:
AB={Y Initial C2 Change C21 107 14 22 3713 98 29 76 12 }
Best Answer