What you get with: (0:n-1)*n + 1:n
Mostrar comentarios más antiguos
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
Respuesta aceptada
Más respuestas (3)
Sean de Wolski
el 12 de Abr. de 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 comentario
Oleg Komarov
el 12 de Abr. de 2011
Sean de Wolski
el 12 de Abr. de 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
el 30 de Abr. de 2023
0 votos
u = 0:1/n:1
Categorías
Más información sobre Logical en Centro de ayuda y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!