How do i display a binary matrix in the command window for a 2D axis plot?
Mostrar comentarios más antiguos
My code is below;
Respuestas (1)
Walter Roberson
el 21 de Mayo de 2015
num2str(YourBinaryMatrix, '%1d ')
5 comentarios
Yashlin Naidoo
el 21 de Mayo de 2015
Walter Roberson
el 21 de Mayo de 2015
S = num2str(YourBinaryMatrix,'%1d ') is effectively the same as
nrows = size(YourBinaryMatrix,1);
S = cell(nrows,1);
for K = 1 : nrows
S{K} = sprintf('%1d ', YourBinaryMatrix(K,:));
end
S = char(S);
num2str() differs from this in that num2str() figures out the maximum width columns will need to be ahead of time and uses format strings adjusted so that the columns will print out nicely lined up. That lining up is not necessary in the simple case of binary values; it would start coming into play if, for example, you had some values that were single digit numbers and other values that were two digit numbers.
Yashlin Naidoo
el 21 de Mayo de 2015
Yashlin Naidoo
el 21 de Mayo de 2015
Yashlin Naidoo
el 21 de Mayo de 2015
Categorías
Más información sobre Convert Image Type en Centro de ayuda y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!