0
我已经写一个for循环在其中沿着每个使得它们中的列的相应的分割5000行。包含这些行中的单元阵列的做一个字符串分割为多行中MATLAB
实施例:
从这张图片中,我想分别沿着它们各自的列开始从第一列开始到结束每一行。
这是我写的代码:
for i = pdbindex(:,1)
clean_pdb = regexprep(pdbindex, ':', ' '); % removes the colon (:) from the array and replaces it with a whitespace
pdb2char = char(clean_pdb); % converts the cell array into a character array
pdb2split = strsplit(pdb2char, ' '); % does a split based on the character array followed by a delimiter, which is the white space
end
我用正则表达式替换冒号(:),一个空格。然而,它给我一个错误,说明Input strings must have one row.
。我不知道如何解决这个问题。
请指教。
看起来你的第一行是空的。试试'for i = pdbindex(2:end,1)'。 – Pursuit 2012-02-20 19:21:53
我的歉意。我已经完成了对单元阵列的修改。我已将鼠标光标移动到行上,并在我测试了for循环后回车。 – Jeiman 2012-02-20 19:26:26