I have a cell array with 2 columns in Matlab:
x = {'A', 0
' ', 1
' ', 1
'B', 1
' ', 0
' ', 1
'C', 1
' ', 0
' ', 1}
I basically want to write a loop that will look at all the elements of column 1 and if, for example, it finds A then for the next two rows that are ''
I want it to label them A as well. Then if it finds B then replace the next two rows with B and then with C... so on...
I tried to use repmat:
for i=1:size(x,1)
a=repmat({x(i,1),3,1});
end
I also tried this:
b = {};
for i = 1:size(x,1)
b = {b repmat(x{i,1}, 3, 2)};
end
But I don't get the desired result. Can anyone help?
Thanks