How do I create the follow array: [0 0 0 ... 0 1 2 ... 100 100 100], where there are 100 zeros on the left and 100 100's on the right? I must use the colon operator.
3 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
For previous questions I just used, for example, [0:0.01:1], to create the array from 0 to 1 using increments of 0.01. I just do not know how to include multiple numbers before and after the beginning and end terms.
2 commentaires
Jan
le 31 Août 2017
Please mention it, when you post a homework question. This requires a different kind of answering.
Stephen23
le 31 Août 2017
Modifié(e) : Stephen23
le 31 Août 2017
@Sebastiano Inturrisi: rather than wasting time asking questions about how to use basic MATLAB, you should simply do the Introductory Tutorials, and learn how to concatenate arrays yourself:
Also reading the documentation is a good idea: zeros, ones, etc.
Réponse acceptée
Jan
le 31 Août 2017
Use the square brackets for a concatenation of arrays:
[1, 3, 5, 4]
or
a = 1:5;
b = [a, a]
Now create the 3 needed parts of the result and join them.
Please note that such basic questions are explained exhaustively in the Getting Started chapters of the documentation. It is efficient to read them, while asking the very basics in the forum is slower, because you have to wait until someone rephrases the information given in the documentation already.
2 commentaires
Plus de réponses (0)
Voir également
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!