Borrar filtros
Borrar filtros

added different number of column using for loop

2 visualizaciones (últimos 30 días)
Saiem Solimullah
Saiem Solimullah el 5 de Jun. de 2018
Comentada: Paolo el 7 de Jun. de 2018
How to add or multiply two different size of array using the loop iteration process? suppose ,an array
a=[1 2 3 4 5 6 7 8 9 ]
b=[1 2]
and i want increase the size of the 'b' array using. for loop. as like the value of 'b' after using for loop is
= [1 2 1 2 1 2 1 2 1]
Then, we will add or multiply this array.That will very much appreciating if anyone can give a matlab code for this problem....

Respuestas (1)

Stephen23
Stephen23 el 5 de Jun. de 2018
>> c = repmat(b,1,ceil(numel(a)/numel(b)));
>> c = c(1:numel(a))
c =
1 2 1 2 1 2 1 2 1
  2 comentarios
Saiem Solimullah
Saiem Solimullah el 7 de Jun. de 2018
matlab 14 doesnt have the "repmat" function...
Paolo
Paolo el 7 de Jun. de 2018
The documentation page for repmat indicates that it was introduced before R2006a.

Iniciar sesión para comentar.

Categorías

Más información sobre Loops and Conditional Statements en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by