how can i obtain this ?

1 vue (au cours des 30 derniers jours)
diadalina
diadalina le 21 Nov 2017
Commenté : diadalina le 21 Nov 2017
i would like to use the command reshape to convert a vector v=11:99 to a matrix (9x9), how can i do this, can anyone help me ?

Réponse acceptée

Birdman
Birdman le 21 Nov 2017
You can not do it when v=11:99.
If you want to convert to 9x9 matrix, then you need to have 81 elements in your vector, with this you have 89. If you define it as v=11:91, then the following command will do what you want.
v=reshape(v,9,9)
  13 commentaires
Birdman
Birdman le 21 Nov 2017
v=11:99;
IND=find(mod(v,10)==0);
v(IND)=[];
v=reshape(v,9,9)
diadalina
diadalina le 21 Nov 2017
that's exactly , what i want, thank you very much.

Connectez-vous pour commenter.

Plus de réponses (1)

KL
KL le 21 Nov 2017
Simpler with just one line,
bsxfun(@plus,1:9,(10:10:90).')
  1 commentaire
diadalina
diadalina le 21 Nov 2017
thank you Mr,Kl for your answer.

Connectez-vous pour commenter.

Catégories

En savoir plus sur Matrix Indexing 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