What you get with: (0:n-1)*n + 1:n
Mostra commenti meno recenti
What you get with:
n = 4;
(0:n-1)*n + 1:n % 1 2 3 4
I was expecting:
(0:n-1)*n + (1:n) % 1 6 11 16
Risposta accettata
Più risposte (3)
Sean de Wolski
il 12 Apr 2011
And the transpose acts as expected:
>> ((0:n-1)*n)'
ans =
0
4
8
12
>> ans+(1:n)'
ans =
1
6
11
16
1 Commento
Oleg Komarov
il 12 Apr 2011
Sean de Wolski
il 12 Apr 2011
I'm able to replicate this. Mac OSX R2009b.
It also fails if I break it between lines:
>> ((0:n-1)*n)
ans =
0 4 8 12
>> ans+1:n
ans =
1 2 3 4
VIGNESH
il 30 Apr 2023
0 voti
u = 0:1/n:1
Categorie
Scopri di più su Matrices and Arrays in Centro assistenza e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!