In the "Section 5 - Further Practice" of MATLAB Onramp, it is stated that, "Indices can be non-consecutive numbers. Try extracting the first, third, and sixth elements of density.". How to do it ?

6 vues (au cours des 30 derniers jours)
In the "Section 5 - Further Practice" of MATLAB Onramp, it is stated that, "Indices can be non-consecutive numbers. Try extracting the first, third, and sixth elements of density.". How to do it ?

Réponses (2)

Lan Lou
Lan Lou le 1 Sep 2020
You would use:
p=density([1 3 6],:)
or
p=density([1 3 6],end)
or
p=density([1 3 6],1)
  2 commentaires
Jon Wagner
Jon Wagner le 18 Sep 2020
p=density([1 3 6],1) is correct. this gives the 1st 3rd and 6th element of column 1. since elements start at the top of the first column and move down, then to top of next column.
vashisht kant
vashisht kant le 17 Oct 2020
all three are correct since there is only one column

Connectez-vous pour commenter.


Renad Saad
Renad Saad le 12 Nov 2020
how to do the further practice ???

Catégories

En savoir plus sur Interpolation dans Help Center et File Exchange

Produits


Version

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by