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!