extract small vector from large vector
12 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Chaudhary P Patel
el 8 de Abr. de 2022
Comentada: Voss
el 15 de Abr. de 2022
b=[1;2;3;4;5;6;7;8;9;10;11;12;13;14;15];
a=zeros(3,1);
c=([a;b]);
d=(c(1,1):c(6,1));
e=(c(4,1):c(9,1));
please suggest me the way how can i write the code for vector d and e.
i want d vector as; d= [0;0;0;1;2;3] and
vector e as ; e=[1;2;3;4;5;6]
0 comentarios
Respuesta aceptada
Voss
el 8 de Abr. de 2022
b = [1;2;3;4;5;6;7;8;9;10;11;12;13;14;15];
a = zeros(3,1);
c = [a; b]
d = c(1:6,1) % ",1" not necessary since c only has one column
e = c(4:9) % ",1" omitted
8 comentarios
Voss
el 15 de Abr. de 2022
That uses the value of Utdelt that was calculated for n=5. Previously calculated Utdelt values, i.e., for n=1 through n=4, are not used. Maybe that's what's wrong.
Más respuestas (0)
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!