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

3 vues (au cours des 30 derniers jours)
Yousif Alaraji
Yousif Alaraji le 25 Déc 2021
Réponse apportée : Voss le 26 Déc 2021
How to Change block "Data Type conversion" to MATLAB Function Script?

Réponses (1)

Voss
Voss le 26 Déc 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

Catégories

En savoir plus sur Logical dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by