Insert values for every after 4th cell in a row
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Damith
el 19 de Mayo de 2014
Comentada: Damith
el 19 de Mayo de 2014
Hi,
I have Z=nan(1:10000). Also, I have Matrix2=(1 x 2499) which has values. I need to insert values of Matrix2 in Z but in every 4th column (for example column numbers of Z will be 1:5:9:13 upto 9993 of Z meaning all the 2499 values of Matrix2 will be in Z. But, the dimension of Z remains same (1 x 10000). The remaining cells of Z will remain as nan. How can I do this MATLAB.
Any help is appreciated.
Thanks.
0 comentarios
Respuesta aceptada
Azzi Abdelmalek
el 19 de Mayo de 2014
z=nan(1,10000)
Matrix2=rand(1,2499); % Example
n=numel(Matrix2);
z(1:4:4*n)=Matrix2
Más respuestas (0)
Ver también
Categorías
Más información sobre Matrix Indexing 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!