Initializing all rows with one set of values in one half and another set in the other half
Mostrar comentarios más antiguos
The following line of code works for initializing the first row of an array:
cA(1,:)=[cA0*ones(1,(N-1)/2+1),Kw/cB0*ones(1,(N+1)/2-1)];
However, I would like to initialize all rows of the array with this "code". I thought the following would work, but it doesn't.
cA(:,:)=[cA0*ones(1,(N-1)/2+1),Kw/cB0*ones(1,(N+1)/2-1)];
MatLab is throwing up an error that it doesn't recognize function or variable 'ones'. How do I initialize all rows in cA with what I originally had for just the first row.
Respuesta aceptada
Más respuestas (1)
David Hill
el 20 de Sept. de 2021
cA=repmat([cA0*ones(1,(N-1)/2+1),Kw/cB0*ones(1,(N+1)/2-1)],number_of_rows,1);
Categorías
Más información sobre Axis Labels en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!