필터 지우기
필터 지우기

create a matrix!

조회 수: 4 (최근 30일)
Andrea
Andrea 2012년 6월 1일
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
Walter Roberson
Walter Roberson 2012년 6월 1일
Please do not Tag specific individuals for a question, as it puts pressure on the named person to answer.

댓글을 달려면 로그인하십시오.

채택된 답변

Honglei Chen
Honglei Chen 2012년 6월 1일
repmat(col,2,1)
or
repmat(col,numel(row),1)
  댓글 수: 4
Andrea
Andrea 2012년 6월 1일
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 2012년 6월 6일
You may want to start a new thread and explain the issue. I'm sure someone here can help.

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Ryan
Ryan 2012년 6월 1일
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
Andrea
Andrea 2012년 6월 1일
It works for all row and col. Thanks a lot.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by