Matrix (Resultant from an Expression) Indexing

3 visualizzazioni (ultimi 30 giorni)
Say I want to get the length of an array A . Normally I would do:
[m,n]=size(A)
And then use the n in other expressions.
But what if I want to get my n immediately; is there anything of the form
n=size(A)(2)
analogous to how I would pull the second element n from an array N using
n=N(2)
?

Risposta accettata

Wayne King
Wayne King il 26 Dic 2013
Modificato: Wayne King il 26 Dic 2013
Yes
A = randn(20,10);
size(A,2)
size(A,1)
So
N = size(A,2);
Did you read the help?
  2 Commenti
A.
A. il 29 Dic 2013
Thank you. I did read the help, but it seems not attentively enough.
Am I assuming similar functions will follow the same pattern f(A,n) , where n is [1 to max size of the output array].

Accedi per commentare.

Più risposte (0)

Categorie

Scopri di più su Creating and Concatenating Matrices in Help Center e File Exchange

Tag

Community Treasure Hunt

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

Start Hunting!

Translated by