程序如下:这里为什么rows能对col操作?

 [values rows]=max([2 7 42;
9 14 8;
10 12 45])

values =

10 14 45

rows =

3 2 3

>> [value col]=max(values)

value =

45

col =

3

>> row=rows(col)

row =

3

牧羊人nacy
浏览 167回答 2
2回答

不负相思意

Matlab中rows()函数的作用:返回引用或数组的行数。语法使用:ROWS(array);参数:Array 是需要得到其行数的数组、数组公式或对单。元格区域的引用:实例:公式“=ROWS(A1:A9)”返回9,=ROWS({1,2,3; 4,5,6;1,2,3})返回3。

一只名叫tom的猫

这里的rows是一个方法,你可以调用,不是咱们平常的行的意思!你可以看看help rows:function nrows = rows(cursor)%ROWS Get number of rows in fetched data set.% NROWS = ROWS(CURSOR) returns the number of rows% retrieved by a database fetch operation. CURSOR is% a cursor structure in which all elements have values.%% Example:%% nrows = rows(cursor)%% upon execution of the function nrows contains the% the number of rows returned by the fetch.%% cursor=exec(conn,'select * from employees');% cursor=fetch(cursor);% nrows=rows(cursor)%% nrows = 9%% indicating there are 9 rows returned by FETCH.%% See also FETCH.% Author: E.F. McGoldrick, 09-02-97% Copyright 1984-2003 The MathWorks, Inc.% $Revision: 1.14.4.2 $ $Date: 2004/04/06 01:05:11 $%if isempty(cursor.Cursor)nrows = -1;return;endif ~isempty(cursor.Fetch)nrows = double(rowsFetched(cursor.Fetch));elsenrows = -1;end;
打开App,查看更多内容
随时随地看视频慕课网APP