Azzera filtri
Azzera filtri

double2str and bin2str

49 visualizzazioni (ultimi 30 giorni)
Rashmi Sao
Rashmi Sao il 14 Nov 2021
Risposto: Steven Lord il 14 Nov 2021
Is there any valid commands in matlab like double2str and bin2str for data type conversion and storage?

Risposte (2)

Awais Saeed
Awais Saeed il 14 Nov 2021
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)
  1 Commento
Awais Saeed
Awais Saeed il 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))
Str = "The binary string is: 1 1 1 1 0 1 1 0 0 0"
ans = 'string'

Accedi per commentare.

Steven Lord
Steven Lord il 14 Nov 2021
See the functions listed on this category page in the documentation.


Scopri di più su Characters and Strings in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by