Change block "Data Type conversion" to MATLAB Function Script.
조회 수: 2 (최근 30일)
이전 댓글 표시
How to Change block "Data Type conversion" to MATLAB Function Script?
댓글 수: 0
답변 (1개)
Voss
2021년 12월 26일
Something like this?
function out = convert_type(in)
if ischar(in)
% convert character array to numeric array
out = str2num(in);
elseif isnumeric(in)
% convert numeric array to character array
out = num2str(in);
else
% unsupported type
out = in;
end
end
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 String에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!