Hi, How to remove white spaces from A=[1 0 0 0 1] binary data & how to copy the binary data in A to a text file?. Thanks in advance.
4 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Megha Nair
el 21 de Mayo de 2018
Comentada: Megha Nair
el 21 de Mayo de 2018
1. I tried using ~isspace command but i am getting the same output with space.
2. I tried fprintf, but the generated file contains something like cubes symbol. Which format in 'formatspec' will get this right for me?
I need something like this when A=[1 0 0 0 1] is given as input.
1* A=[10001]
2* A.txt should contain the 1*
Please help.
0 comentarios
Respuesta aceptada
Walter Roberson
el 21 de Mayo de 2018
Editada: Walter Roberson
el 21 de Mayo de 2018
fid = fopen('A.txt', 'wt');
fprintf(fid, '%d', A);
fprintf(fid, '\n');
fclose(fid);
Or:
fid = fopen('A.txt', 'wt');
fprintf(fid, '%s\n', char(A+'0'));
fclose(fid);
Más respuestas (0)
Ver también
Categorías
Más información sobre Standard File Formats 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!