Posted by : Unknown Thursday, October 24, 2013

Matlab


Deletion Of Row In Mat lab

if there is a given a matrix e.g 

A=[1 2 3; 4 5 6; 7 8 9; 10 11 12]

 if we want to remove fourth row then there is a specific command in MAT LAB with the help of which we can eliminate a row as well column :
    we normally represent a vector A(row,column) 
  A(1:3,1:3)  //1:3 represents First three row and same 1:3 represent first three column

ans =

     1     2     3
     4     5     6
     7     8     9

Another Method 

If you want to remove a specific row in any matrix then use this command
A(2,:)=[]         // if you want to remove nth row then use this command A(n,:)

A =

     1     2     3
     7     8     9
    10    11    12

Deletion Of Column In Mat lab

A=[1 2 3; 4 5 6; 7 8 9; 10 11 12]

Same here if we want to remove a column then same we use a same method. E.g if we want to remove a third column from a matrix then we use a command

 A(1:3, 1:2)   // 1:3 represents one to third row and same 1:2 represent first two column

ans =

     1     2
     4     5
     7     8

Another Method 

If you want to remove a specific column in any matrix then use this command
A(,:2)=[]         // if you want to remove nth row then use this command  A(,:n)

A =

     1     2     3
     7     8     9
    10    11    12


Leave a Reply

Subscribe to Posts | Subscribe to Comments

Let's Join Us

This blog is for Computer Programming Learner or who is interested in to learn different programming languages

Get Toolbar Free

Get our toolbar!

FeedBurner FeedCount

Computer Problems

Total Pageviews

Popular Post

Labels

About Us

I am a student Of computer Engineering , Studying at UET Taxila. Web development and Programming is my passion. http://about.me/umair.tariq

Top Commentators

Followers

Powered by Blogger.

Recent comments

- Copyright © Computer Problems -Metrominimalist- Powered by Blogger - Designed by Johanes Djogan -