Search code examples
arraysmatlabsplitcell

Undefined function or method 'split' for input arguments of type 'cell' in MATLAB


I wrote a code in which i would like to split a number of rows along each column that it is represented in based on a delimiter. I wrote a for loop in which it does it for me.

Pdbindex is a cell array, where my values are stored that i am trying to split with a delimiter, a colon (:).

enter image description here

for i = pdbindex(:,1)

    clean2_pdb = split(':', pdbindex);

end

However, it threw me an error stating, Undefined function or method 'split' for input arguments of type 'cell'..

I don't know to solve this.

Please advise.

Update:

I have also posted another question of using strsplit function. A different problem pops up.

Link : Strsplit function


Solution

  • There's no such function called split. What you want is:

    for i = 1:size(pdbIndex, 1)
        clean2_pdb = regexp(pdbIndex{i,1}, ':', 'split');
    end