it says error using assert, assertion failed and error in iuntitled (line 10) assert(ischar(in))
조회 수: 34 (최근 30일)
Geoff Hayes 2022년 6월 17일
@Ian - as per the function comment, Encode a single character i. I suspect that you are passing something else i.e. a numeric value like
Error using encodeCharacter (line 8)
or any other character. Note that you can only pass in one character. If you pass in 2 or more, then a different assert will fire.
Cris LaPierre 2022년 6월 17일
That is what an assert does. If the assertion fails (here that means that in is not a char), then an error is thrown and the message 'Assertion failed.' is thrown.
% Assertion is true -> no error
in = '5';
% Assertion is false -> error
in = 5;