
The contents in the cell array are as in the image showed above. I have two issues:
I have to move cells in columns to the preceding ones wherever there are
0s. For example inrow 1, the1x7cell has to come to the cell after1x19cell and so on.While doing this, the cells with
[]should also be moved replacing the preceding0s.
I tried using strncmp, ismember and other functions, but the 0 is throwing errors.
UPDATE with working code
The code is this:
It doesnt do all the work though. The cells being copied have to be deleted from the end.
for m=1:200
for i=1:46
for j=1:199
try
if(tags{i,j}==0)
for k=j:199
tags{i,k}=tags{i,k+1};
tags{i,k+1}='';
end
end
catch exception
end
end
end
end
EDIT - Question's part 2 : Not solved yet
Each of the cells contains strings. Is there any way I can write them to a text file? All the strings in a cell have to be in the same line followed by a new line for the strings in the next cell.
Again, I tried this using a lot of functions, but I am unable to do it properly. I just get the first string in every cell to the text file.
[]?1x7cell into the first0? And the only problem is the deletion of the0? or do you have problems with the writing as well? Could you post your code which you have so far?[], and, for every row, fill cols 1:n with the non-zero entries.