I have the following code in matlab and trying to remove an element from a struct: 
function test()
    C = struct;
    C.(sprintf('Ck')) = [1 6 8 9; 8 6 9 7; 7 6 67 6; 65 7 8 7];
    ck_length = length(C.(sprintf('Ck')));
    for i=1:ck_length
        if C.(sprintf('Ck'))(i)> 10
           cleared = rmfield(C.(sprintf('Ck')), C.(sprintf('Ck'))(i));
        end
    end
end
But, when I run the program I get an error as shown below:
>> test
??? Error using ==> rmfield at 19
S must be a structure array.
Error in ==> test at 89
   cleared = rmfield(C.(sprintf('Ck')), C.(sprintf('Ck'))(i));
How can I solve this issue?
Thanks.
 
     
    