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.
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
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 Commenti
Jan
il 31 Ago 2017
Please mention it, when you post a homework question. This requires a different kind of answering.
Stephen23
il 31 Ago 2017
Modificato: Stephen23
il 31 Ago 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.
Risposta accettata
Jan
il 31 Ago 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 Commenti
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Matrix Indexing in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!