Hi, the first thing I think to is to use for loops to control all position in both matrices.
[ra ca]=size(A);
[rb cb]=size(B);
t=1;
for i=1:ra
for j=1:ca
for k=1:rb
for l=1:cb
if A(i,j)==B(k,l)
C(t)=A(i,j);
t=t+1;
end;
end;
end;
end...
When you work with Guide all variables you want to use must be defined in handles structure. If you want to use variable Tbread, you should define it in the Opening_Function of your Guide Program, for example.
...
handles.Tbread=0;
...
guidata(hObject,handles);
The last line save all the...