Borrar filtros
Borrar filtros

create a matrix!

4 visualizaciones (últimos 30 días)
Andrea
Andrea el 1 de Jun. de 2012
Hello I have
row=[1 2];
col=[10 11 13 ];
I want to have b=[10 11 13; 10 11 13]
How can i do that?
  1 comentario
Walter Roberson
Walter Roberson el 1 de Jun. de 2012
Please do not Tag specific individuals for a question, as it puts pressure on the named person to answer.

Iniciar sesión para comentar.

Respuesta aceptada

Honglei Chen
Honglei Chen el 1 de Jun. de 2012
repmat(col,2,1)
or
repmat(col,numel(row),1)
  4 comentarios
Andrea
Andrea el 1 de Jun. de 2012
It works now. I have some little matrices with different size (such as 7*3, 2*5, 8*1,...) and I need to put them in a bigger matrix. My problem actually is I want similar arrays with similar row or col is put in the same position (array) in the bigger matrix. It actually have taken a lot of time until now and no matter how much I have spent on it, It still does not work!
Honglei Chen
Honglei Chen el 6 de Jun. de 2012
You may want to start a new thread and explain the issue. I'm sure someone here can help.

Iniciar sesión para comentar.

Más respuestas (1)

Ryan
Ryan el 1 de Jun. de 2012
row = [1 2];
col = [10 11 13];
b = ones(length(row),length(col));
clear m
for m = 1:length(row)
b(m,:) = col;
end
  1 comentario
Andrea
Andrea el 1 de Jun. de 2012
It works for all row and col. Thanks a lot.

Iniciar sesión para comentar.

Categorías

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

Etiquetas

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by