Change block "Data Type conversion" to MATLAB Function Script.

3 visualizaciones (últimos 30 días)
Yousif Alaraji
Yousif Alaraji el 25 de Dic. de 2021
Respondida: Voss el 26 de Dic. de 2021
How to Change block "Data Type conversion" to MATLAB Function Script?

Respuestas (1)

Voss
Voss el 26 de Dic. de 2021
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

Categorías

Más información sobre Data Type Conversion en Help Center y File Exchange.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by