Effacer les filtres
Effacer les filtres

How do i make a matrix like this

3 vues (au cours des 30 derniers jours)
Oskore Mune
Oskore Mune le 29 Avr 2018
Commenté : Walter Roberson le 29 Avr 2018
I'm trying to make a matrix with two columns. The second column is from .5 to 20 with .1 increments and i want the first column to have .5 for as many rows the second column gives, but I also want this to happen for .6, .7, .8, .9, 1, 1.1,... and all the way up to 20 with .1 increments in the same matrix.
i put a picture of a small portion for what i'm talking about.

Réponse acceptée

Walter Roberson
Walter Roberson le 29 Avr 2018
[C1, C2] = ndgrid(0.5:.1:20);
matrix = [C1(:), C2(:)];
  3 commentaires
KALYAN ACHARJYA
KALYAN ACHARJYA le 29 Avr 2018
Modifié(e) : KALYAN ACHARJYA le 29 Avr 2018
Are you getting the result as per your requirement? The answer is interesting, that's why I have checked it, I got the result as follows-
Walter Roberson
Walter Roberson le 29 Avr 2018
You can replace ndgrid() with meshgrid() to get the values in the other order.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

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

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by