Writing a matlab function- get number of rows

2 visualizzazioni (ultimi 30 giorni)
Shalini
Shalini il 5 Mar 2012
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?

Risposte (3)

Thomas
Thomas il 5 Mar 2012
Try size(x) to give you the size of the vectors
doc size

Sean de Wolski
Sean de Wolski il 5 Mar 2012
mrows = size(x,1)

Shalini
Shalini il 5 Mar 2012
Thanks a lot..Is it necessary to declare variable mrows in Matlab?
  2 Commenti
Oleg Komarov
Oleg Komarov il 5 Mar 2012
Have you tried the snippets?
Walter Roberson
Walter Roberson il 5 Mar 2012
Declaration of variables was addressed in your topic
http://www.mathworks.com/matlabcentral/answers/31248-variable-declaration-in-matlab

Accedi per commentare.

Categorie

Scopri di più su Get Started with MATLAB in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by