简体   繁体   中英

Error matlab n = rows()

I am stuck in Matlab with the following code:

n = rows(returnport)-1;

I get the following error when running the code:

??? Undefined function or method 'rows' for input arguments of type 'double'.

Can someone help me with this? I use Matlab version 2011a.

rows() is a function of GNU Octave (same for columns() ).

However, you can easily create those function and put them in your startup.m eg

>> rows = @(x) size(x,1)        

rows = 

     @(x)size(x,1)

 >> columns = @(x) size(x,2)

 columns = 

     @(x)size(x,2)

>> m=rand(7,3);
>> rows(m)

ans =

     7

>> columns(m)

ans =

     3

如果returnport是矩阵size(returnport,1)则应为您提供行数。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM