A.8. Finding the Number of Rows and Columns

Often, it is convenient to alllow the program to determine the number of rows and columns in a matrix rather than explicitly specifying it. Functions NROW and NCOL respectively perform the desired task. For example, for a 2 by 3 matrix


the statements

row_in_b = nrow(b);
col_in_b = ncol(b);
print row_in_b, col_in_b;

respectively result in ROW_IN_B = 2 and COL_IN_B = 3.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.144.254.231