G(1,:)=[ 1 2 3 8 5 6 3 5];
for j = 1:10,
for i = 1:8,
n(j,i)=G(1,8);
end
end
i need to calculate 10 rows and 8 columns, G value is = [ 1 2 3 8 5 6 3 5];
i couldn't get the G value in 10 rows.

 採用された回答

Jan
Jan 2011 年 4 月 19 日

1 投票

G = [ 1 2 3 8 5 6 3 5];
n = repmat(G, 10, 1)
or
n = G(ones(1, 10), :);

2 件のコメント

bala k
bala k 2011 年 4 月 19 日
sir, if the G value is change in each row. how to i change the code.
Walter Roberson
Walter Roberson 2011 年 4 月 19 日
for j = 1:10,
for i = 1:8,
n(j,i)=G(1,i);
end
end

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeResizing and Reshaping Matrices についてさらに検索

タグ

質問済み:

2011 年 4 月 19 日

Community Treasure Hunt

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

Start Hunting!

Translated by