フィルターのクリア

How Can I replicate matrix in a loop ?

1 回表示 (過去 30 日間)
Ede gerlderlands
Ede gerlderlands 2012 年 10 月 20 日
Here is a code in which I tried to replicate(create) x(jj)'s which contains numbers from 1 to 26 each contain one value and what I want to get is 20x40 matrix for each of 26 values of x's
Here is the code
m=20 n=40
for jj=1:length(x);
B(jj) = x(jj).*.001;%
B(:,:,jj) = B(ones(m,n));
end
but this code gives 20x40 for the first value of x only . please help me with this ...thanks in advance
  2 件のコメント
Azzi Abdelmalek
Azzi Abdelmalek 2012 年 10 月 20 日
it's not clear
Ede gerlderlands
Ede gerlderlands 2012 年 10 月 20 日
編集済み: Ede gerlderlands 2012 年 10 月 20 日
The point is I want to create 20x40 matrix for each value of X. X has 26 values in my case. To clarify this if x=0.1:1:0.9 and I want to create 20x40 matrix which has values 0.1 to 0.9 makes it 9 matix i.e. 0.1 replicates(20x40), 0.2(20x40)....0.9(20x40) is that not clear now? tnx

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

採用された回答

Azzi Abdelmalek
Azzi Abdelmalek 2012 年 10 月 20 日
x=0.1:0.1:0.9
B=repmat(reshape(x,1,1,length(x)),20,40)
  1 件のコメント
Ede gerlderlands
Ede gerlderlands 2012 年 10 月 20 日
Thanks for your help ..

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLoops and Conditional Statements についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by