I am trying to write several rows of a cell array into one box of a new cell array.
x = {('Q');('N');('Q');('New');('Q');('N');('Q');}
I need to output a cellarray that has all the Q's and when it reaches 'New' it goes to the next row so the output looks like this:
y = {('Q Q' ; 'Q Q'}
As of right now I have this:
x = {('Q');('N');('Q');('New');('Q');('N');('Q');} q = string(x);% T = table()
c = {};for i = 1:numel(x) if strcmp(q(i),'Q') || strcmp(q(i),'L') c = {strjoin(q(i),' ')} else strcmp(q(i),'New') endend
A good point to touch on is that the x array will not be periodic always.
Best Answer