create a matrix!
2 views (last 30 days)
Show older comments
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 Comment
Walter Roberson
on 1 Jun 2012
Please do not Tag specific individuals for a question, as it puts pressure on the named person to answer.
Accepted Answer
Honglei Chen
on 1 Jun 2012
repmat(col,2,1)
or
repmat(col,numel(row),1)
4 Comments
Honglei Chen
on 6 Jun 2012
You may want to start a new thread and explain the issue. I'm sure someone here can help.
More Answers (1)
Ryan
on 1 Jun 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
See Also
Categories
Find more on Logical in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!