Extracting element form a table of data

4 views (last 30 days)
ADEDAPO ADEGUN
ADEDAPO ADEGUN on 6 Oct 2015
Commented: Adam on 6 Oct 2015
Hello, Please what command will I use if I want to extract element form table of table data. E.g if I have 5 by 5 matrix element and I need to read 3 by 3 element located in row 3, row 3, row 4 and column 2, column 3, column 4. Please what command can I use to extract these elements. Thanks

Answers (1)

Adam
Adam on 6 Oct 2015
If by 'table', you mean an array:
result = myArray( 2:4, 2:4 );
will read, for example, the 2nd to 4th rows and 2nd to 4th columns, giving you a 9-by-9 result array.
If you mean an actual 'table' structure then I am less familiar with that, but
doc table
seems to give various examples of manipulating table data.
  2 Comments
ADEDAPO ADEGUN
ADEDAPO ADEGUN on 6 Oct 2015
If I want to read the first row and last row or first column and last column. That is actually my question Thanks
Adam
Adam on 6 Oct 2015
result = myArray( [1 end], : );
result = myArray( :, [1 end] );
will give you, respectively, the 1st and last row and the first and last column (assuming you want all columns for each row and all rows for each column)

Sign in to comment.

Categories

Find more on Tables in Help Center and File Exchange

Tags

No tags entered yet.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!