Splitting string by number of characters matlab

后端 未结 2 627
慢半拍i
慢半拍i 2021-01-19 19:05

Is there any builtin function in Matlab that cuts string by the number of characters and returns it as a cell array or something. For example if call A = some_function(strin

2条回答
  •  悲&欢浪女
    2021-01-19 19:34

    A little long may be:

    ns = numel(string);
    n = 3;
    A = cellstr(reshape([string repmat(' ',1,ceil(ns/n)*n-ns)],n,[])')'
    

提交回复
热议问题