vectors from array

19 vues (au cours des 30 derniers jours)
Gary
Gary le 14 Déc 2011
What is the best way to create vectors from columns of an array?

Réponse acceptée

David Young
David Young le 14 Déc 2011
vector = array(:, column_number)
  5 commentaires
Gary
Gary le 14 Déc 2011
How can I get separate vectors such as V1, V2 and V3. Thanks
Paulo Silva
Paulo Silva le 14 Déc 2011
see my Answer and http://matlab.wikia.com/wiki/FAQ#How_can_I_create_variables_A1.2C_A2.2C....2CA10_in_a_loop.3F

Connectez-vous pour commenter.

Plus de réponses (1)

Paulo Silva
Paulo Silva le 14 Déc 2011
a=randi(5,3,5) %sample array
%put all columns of the array in diferent cells
b=arrayfun(@(x)a(:,x),1:size(a,2),'uni',0);
c=1; %choose the column
v=b{c} %get the vector of that column

Catégories

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

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by