How To Replace BELOW THRESHOLD element of Matrix with zero in MATLAB

Previously we discussed about, How to Split matrix into number of Sub-Matrix in MATLAB using matlab program. Now in Post-14 of Module-01, we will discuss about the matlab code, how to replace below threshold element of matrix.

To understand this problem, we are taking a matrix of 4x4 dimension. We will replace its below threshold element with zero using matlab program. In this matlab program we have set threshold limit to 17 but you can vary it according to your requirement. A matlab program for this has been shown in figure-1.

Figure.1 - MATLAB Program for replacement of below threshold element of matrix with zero in MATLAB.

A message written in single quote will be display on command window using command written in line-5. A matrix has been loaded into matlab using command written in line-6. Command written in line-9 is checking individual element of matrix one-by-one with the help of two loops and comparing it with threshold value. If this individual element value is less than threshold value then replacing this element with zero using command written in line-10 else doing nothing. Both 'for' loops i & j has been used for row & column respectively as written in line-7 & line-8. MATLAB program first of all select first row by putting i=1, and it complete all the columns by putting j=1 to 4 one-by-one. Similarly, It select second row by putting i=2, and it complete all the columns by putting j=1 to 4 one-by-one. This process is continued upto fourth row. Command written in line-16 display a message written in single quote. After this updated matrix has been displayed on command window using matlab code written in line-17.

Output of the above written matlab program on command window has been shown in figure-2, which showing matrix 'A' two times.

Figure.2 - Command Window Output of replacement below threshold element with zero.

First matrix 'A' is the actual matrix which we loaded in matlab. While second matrix 'A' is the updated matrix in which element below threshold value 17 has been replaced by zero.

Video Tutorial : How To Replace Below Threshold Element of Matrix in MATLAB.

Brought to you By INFO4EEE (Website, Channel, and Classes).

1 comment:

  1. Pretty great post. I simply stumbled upon your blog and wanted to mention that I have really loved surfing around your blog posts. Great set of tips from the master himself. Excellent ideas. Thanks for Awesome tips Keep it

    MATLAB Crack

    VSDC Video Editor Pro Crack

    Burnaware Professional Crack

    GstarCAD Professional Crack


Powered by Blogger.