How can I display a 2D binary matrix as a black & white plot?

 I have a 2D binary matrix that I want to display as a black and white plot. For example, let's say I have a 4-by-4 matrix as follows: 

 
1 1 0 1
0 0 1 0
1 1 0 1
1 0 0 0

How can this be plotted as a black and white matrix? Some of my input binary matrices are of size 100-by-9, so I would ideally need a solution that generalizes to different sized matrices. 

NOTE:-


Matlabsolutions.com provide latest MatLab Homework Help,MatLab Assignment Help , Finance Assignment Help for students, engineers and researchers in Multiple Branches like ECE, EEE, CSE, Mechanical, Civil with 100% output.Matlab Code for B.E, B.Tech,M.E,M.Tech, Ph.D. Scholars with 100% privacy guaranteed. Get MATLAB projects with source code for your learning and research.

mat = [1 1 0 1; 0 0 1 0; 1 1 0 1; 1 0 0 0];  % Your sample matrix
[r, c] = size(mat);                          % Get the matrix size   
SEE COMPLETE ANSWER CLICK THE LINK 
https://matlabhelpers.com/questions/how-can-i-display-a-2d-binary-matrix-as-a-black-white-plot-.php

Comments

Popular posts from this blog

Why do I get a "Too many input arguments" error when not passing any?

programmingshark

Why Red, Green, Blue channels of image separetely are grayscaled (Matlab)?