Code covered by the BSD License  

Highlights from
MATLAB xUnit Test Framework

image thumbnail

MATLAB xUnit Test Framework

by

 

31 Jan 2009 (Updated )

MATLAB xUnit is a unit test framework for MATLAB code.

Editor's Notes:

This file was selected as MATLAB Central Pick of the Week

xunit.utils.stringToCellArray(s)
function c = stringToCellArray(s)
%stringToCellArray Convert string with newlines to cell array of strings.
%   C = stringToCellArray(S) converts the input string S to a cell array of
%   strings, breaking up S at new lines.

%   Steven L. Eddins
%   Copyright 2009 The MathWorks, Inc.

if isempty(s)
    c = cell(0, 1);
else
    c = textscan(s, '%s', 'Delimiter', '\n', 'Whitespace', '');
    c = c{1};
end

Contact us