How many elements in one row matrix?

2 vues (au cours des 30 derniers jours)
fathi
fathi le 14 Mai 2017
Commenté : fathi le 14 Mai 2017
I like to know how many elements of one-row matrix.///
EX: V = [ 2 3 4 8 6 4 7 9 ], the answer is 8 wich the number of elements in one row.////
Thank you

Réponse acceptée

Walter Roberson
Walter Roberson le 14 Mai 2017
size(V,2)
is specifically the number of columns in V, even if V is multi-dimensional.
In the case where you know V is a vector, then length(V) can be used, provided that you want a column vector with 8 elements to return the same as a row vector with 8 elements would.
  1 commentaire
fathi
fathi le 14 Mai 2017
Thank you Walter Roberson , this is what i want.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Resizing and Reshaping Matrices dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by