double2str and bin2str
42 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Is there any valid commands in matlab like double2str and bin2str for data type conversion and storage?
0 commentaires
Réponses (2)
Awais Saeed
le 14 Nov 2021
Doing
help bin2str
% and
help double2str
did not show any results from which I assume there are no such functions. Use num2str() or sprintf instead
binary = randi([0 1],1,10);
binaryStr = sprintf('%d', binary)
binaryStr2 = num2str(binary)
class(binaryStr)
class(binaryStr2)
1 commentaire
Awais Saeed
le 14 Nov 2021
if you strickly want a string then
binary = randi([0 1],1,10);
Str = sprintf("The binary string is: %s", num2str(binary))
class(Str)
Voir également
Catégories
En savoir plus sur Dates and Time 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!