repeating numbers in matrix
12 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
vinayak hungund
el 9 de Jul. de 2015
Respondida: Check Codes
el 4 de En. de 2021
I need to generate a input variation in the form
% For wxample
col1 :2 4 6 2 4 6 2 4 6 2 4 6
col2 :1 1 1 1 1 1 2 2 2 2 2 2
col2 :5 5 5 5 5 5 5 5 5 5 5 5
is there any shorter way to do it without looping.
0 comentarios
Respuesta aceptada
Azzi Abdelmalek
el 9 de Jul. de 2015
Editada: Azzi Abdelmalek
el 9 de Jul. de 2015
col1=repmat(2:2:6,1,3)
col2=reshape(repmat(1:2,6,1),1,[])
col3=5*ones(1,12)
Read the documentation
doc repmat
doc reshape
Más respuestas (1)
Check Codes
el 4 de En. de 2021
P=[6 9 13 31 18]; position=5; Q=[285 65]; /Period matrix number of period =3;
o/p part: out_put =[6 9 13 31 285 65 285 65 285 85 18];
0 comentarios
Ver también
Categorías
Más información sobre Creating and Concatenating Matrices en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!