Writing a matlab function- get number of rows

5 次查看(过去 30 天)
I'm new to Matlab.
I'm writing a matlab function to which I have given the arguments: Params, X,Y
All 3 are vectors.
I want to find out how many rows vector X has.
What is the corresponding matlab command/inbuilt function?
I was thinking of using :
MStruct = get(DMObj)
PropertyValue = get(DMObj, 'NRows')
Any better suggestions please?

回答(3 个)

Thomas
Thomas 2012-3-5
Try size(x) to give you the size of the vectors
doc size

Sean de Wolski
Sean de Wolski 2012-3-5
mrows = size(x,1)

Shalini
Shalini 2012-3-5
Thanks a lot..Is it necessary to declare variable mrows in Matlab?
  2 个评论
Walter Roberson
Walter Roberson 2012-3-5
Declaration of variables was addressed in your topic
http://www.mathworks.com/matlabcentral/answers/31248-variable-declaration-in-matlab

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 MATLAB 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by