Trying to select multiple sections in an array where the sections are separated by constant size
4 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Omer Sholev
il 26 Mar 2018
Commentato: Omer Sholev
il 26 Mar 2018
Let's say that I have an array of size 24, i.e arr=zeros(1,24). Now, let's say that I wan't to set indices [5,6,7,8] and [13,14,15,16] and [21,22,23,24] to 1. So how can I address these array sections without loops? I know that I can write: arr([5:8, 13:16, 21:24]) by hand, but what if the array size is unknown, and I wan't to write it in compact way. Thanks
0 Commenti
Risposta accettata
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Whos 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!