As the title already mentions, how is it possible to add a new cell array 1x1 at the end of an existing cell array, let's call him Q, which is a cell array 1x3256?
            Asked
            
        
        
            Active
            
        
            Viewed 4.0k times
        
    24
            
            
        2 Answers
37
            If you mean adding a single cell to the end (i.e. so your 1-by-3256 cell array becomes a 1-by-3257 cell array) then:
Q{end+1} = []
and you can replace [] with your value directly
Alternatively:
Q(end+1) = {[]}
 
    
    
        Dan
        
- 45,079
- 17
- 88
- 157
- 
                    Man, that was quick... +1 – kkuilla Feb 03 '15 at 12:21
- 
                    Quick and useful reply! Thank you. – nik-OS Feb 03 '15 at 12:26
13
            
            
        Adding to Dan's answer, in case you have a cell that is not a single dimension cell, you might want to add a full row, for example. In that case, access the cell as an array using ().
>> c = { 1, 'a'; 2, 'b'}
c = 
    [1]    'a'
    [2]    'b'
>> c(end+1,:) = {3,'c'}
c = 
    [1]    'a'
    [2]    'b'
    [3]    'c'
 
    
    
        aguadopd
        
- 553
- 8
- 17
